diff options
author | José Valim <jose.valim@gmail.com> | 2012-05-17 23:42:37 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-18 18:26:18 -0300 |
commit | 4dd4621f5bb5500092e635e80e1b1cb1d888b6ec (patch) | |
tree | 636e0a89b328bf4403d3b7aef7d5e4ea98619490 /actionpack/lib | |
parent | 8ad8f61b3f20af106798731144487de40facb25c (diff) | |
download | rails-4dd4621f5bb5500092e635e80e1b1cb1d888b6ec.tar.gz rails-4dd4621f5bb5500092e635e80e1b1cb1d888b6ec.tar.bz2 rails-4dd4621f5bb5500092e635e80e1b1cb1d888b6ec.zip |
Merge pull request #5020 from KL-7/fix-blank-image_tag-source
Render img tag with empty src if empty string is passed to image_tag.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 4 |
1 files changed, 2 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 cf6c007c84..51d5d586bf 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -272,7 +272,7 @@ module ActionView # The alias +path_to_image+ is provided to avoid that. Rails uses the alias internally, and # plugin authors are encouraged to do so. def image_path(source) - asset_paths.compute_public_path(source, 'images') + source.present? ? asset_paths.compute_public_path(source, 'images') : "" end alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route @@ -358,7 +358,7 @@ module ActionView src = options[:src] = path_to_image(source) - unless src =~ /^(?:cid|data):/ + unless src =~ /^(?:cid|data):/ || src.blank? options[:alt] = options.fetch(:alt){ image_alt(src) } end |