diff options
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 4 | ||||
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 251b8f8005..93092ceeb4 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -355,8 +355,8 @@ module ActionView # <img src="/images/mouse.png" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" alt="Mouse" /> # image_tag("mouse.png", :mouseover => image_path("mouse_over.png")) # => # <img src="/images/mouse.png" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" alt="Mouse" /> - def image_tag(source, options = {}) - options.symbolize_keys! + def image_tag(source, options={}) + options = options.dup.symbolize_keys! src = options[:src] = path_to_image(source) diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 37153ee960..92e053134f 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -445,6 +445,12 @@ class AssetTagHelperTest < ActionView::TestCase ImageLinkToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end + def test_image_tag_does_not_modify_options + options = {:size => '16x10'} + image_tag('icon', options) + assert_equal({:size => '16x10'}, options) + end + def test_favicon_link_tag FaviconLinkToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end |