1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Don't try to destoy the given string via method argument

Or it would raise if the argument was frozen.

And even with this change, it would still reduce String allocations together with 9276ea89d2
because `escape` should be `true` in most cases
This commit is contained in:
Akira Matsuda 2018-04-27 03:20:44 +09:00
parent 9276ea89d2
commit 7d2400ab61

View file

@ -88,7 +88,7 @@ module ActionView
if value.is_a?(Array)
value = escape ? safe_join(value, " ".freeze) : value.join(" ".freeze)
else
value = escape ? ERB::Util.unwrapped_html_escape(value) : value.to_s
value = escape ? ERB::Util.unwrapped_html_escape(value) : value.to_s.dup
end
value.gsub!('"'.freeze, '"'.freeze)
%(#{key}="#{value}")