diff options
author | Kirill Lashuk <kirill.lashuk@gmail.com> | 2012-02-13 01:09:44 +0300 |
---|---|---|
committer | Kirill Lashuk <kirill.lashuk@gmail.com> | 2012-05-18 01:39:39 +0300 |
commit | 3e9ec2411abb079403f9f76d59f2a6386dd81768 (patch) | |
tree | ebceec64e29a4672f054c64c11c1760a80678f1f /actionpack/lib | |
parent | b23ac936a6ef980547666da002681a77d8340573 (diff) | |
download | rails-3e9ec2411abb079403f9f76d59f2a6386dd81768.tar.gz rails-3e9ec2411abb079403f9f76d59f2a6386dd81768.tar.bz2 rails-3e9ec2411abb079403f9f76d59f2a6386dd81768.zip |
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 a7a4ce21ff..02c1250c76 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -274,7 +274,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 @@ -377,7 +377,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 |