aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-05-03 19:26:43 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-05-03 19:26:43 -0300
commitf17792245ff817afd224c7cc7a1d855511fcf641 (patch)
tree073451b47f35624f8fe1fe8589f84dab27bfcc2a /actionview/lib/action_view/helpers
parenta278668624209b2421634d3dc6ee82b6e0353546 (diff)
parent8cbeec773ffce82dd521469ac37625630ed00701 (diff)
downloadrails-f17792245ff817afd224c7cc7a1d855511fcf641.tar.gz
rails-f17792245ff817afd224c7cc7a1d855511fcf641.tar.bz2
rails-f17792245ff817afd224c7cc7a1d855511fcf641.zip
Merge pull request #18783 from mikestone14/actionview-image-tag-override
Actionview image tag size option override
Diffstat (limited to 'actionview/lib/action_view/helpers')
-rw-r--r--actionview/lib/action_view/helpers/asset_tag_helper.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb
index 60fc9ee1a2..e32f8e219e 100644
--- a/actionview/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb
@@ -207,6 +207,7 @@ module ActionView
# # => <img alt="Icon" class="menu_icon" src="/icons/icon.gif" />
def image_tag(source, options={})
options = options.symbolize_keys
+ check_for_image_tag_errors(options)
src = options[:src] = path_to_image(source)
@@ -325,6 +326,12 @@ module ActionView
[size, size]
end
end
+
+ def check_for_image_tag_errors(options)
+ if options[:size] && (options[:height] || options[:width])
+ raise ArgumentError, "Cannot pass a :size option with a :height or :width option"
+ end
+ end
end
end
end