diff options
author | Nishant Modak <modak.nishant@gmail.com> | 2015-11-20 18:17:23 +0530 |
---|---|---|
committer | Nishant Modak <modak.nishant@gmail.com> | 2015-11-20 23:16:53 +0530 |
commit | 5d45eed2ab9b029da5f6daac4a2834dec2c6bd3d (patch) | |
tree | 27f8ba6b7e8456d4cbf8a64f01363af7b73d4a59 /actionview/lib | |
parent | f6d12b8ea235e5b9c1d23edbff88765d7882ce94 (diff) | |
download | rails-5d45eed2ab9b029da5f6daac4a2834dec2c6bd3d.tar.gz rails-5d45eed2ab9b029da5f6daac4a2834dec2c6bd3d.tar.bz2 rails-5d45eed2ab9b029da5f6daac4a2834dec2c6bd3d.zip |
Example of setting data attributes for image_tag
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/asset_tag_helper.rb | 2 |
1 files changed, 2 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 2ffed6b395..91e934cd64 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -205,6 +205,8 @@ module ActionView # # => <img alt="Icon" height="32" src="/icons/icon.gif" width="32" /> # image_tag("/icons/icon.gif", class: "menu_icon") # # => <img alt="Icon" class="menu_icon" src="/icons/icon.gif" /> + # image_tag("/icons/icon.gif", data: { title: 'Rails Application' }) + # # => <img data-title="Rails Application" src="/icons/icon.gif" /> def image_tag(source, options={}) options = options.symbolize_keys check_for_image_tag_errors(options) |