From 8cbeec773ffce82dd521469ac37625630ed00701 Mon Sep 17 00:00:00 2001 From: Mike Stone Date: Mon, 2 Feb 2015 11:42:19 -0500 Subject: image_tag raises an error if size is passed with height and/or width --- actionview/lib/action_view/helpers/asset_tag_helper.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionview/lib/action_view/helpers/asset_tag_helper.rb') 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 # # => Icon 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 -- cgit v1.2.3