diff options
author | Mike Stone <mike.stone@meyouhealth.com> | 2015-02-02 11:42:19 -0500 |
---|---|---|
committer | Mike Stone <mike.stone@meyouhealth.com> | 2015-04-24 11:26:49 -0400 |
commit | 8cbeec773ffce82dd521469ac37625630ed00701 (patch) | |
tree | e6abc4f0fcd3f71f66a9bb194ec2a15825b63690 /actionview/lib/action_view/helpers | |
parent | b29d794b8cdf59896e668a0f68038dd25228398e (diff) | |
download | rails-8cbeec773ffce82dd521469ac37625630ed00701.tar.gz rails-8cbeec773ffce82dd521469ac37625630ed00701.tar.bz2 rails-8cbeec773ffce82dd521469ac37625630ed00701.zip |
image_tag raises an error if size is passed with height and/or width
Diffstat (limited to 'actionview/lib/action_view/helpers')
-rw-r--r-- | actionview/lib/action_view/helpers/asset_tag_helper.rb | 7 |
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 |