Reputation: 101
I have a scenario in which I only need the src
attribute generated by image_tag
.
ActionController::Base.helpers.image_tag("diane.png")
gives back
<img src=\"/assets/diane-d88012c06a724682b02dfbd9224dbaac15872a3.png\" alt=\"Diane\" />
I only need the string in the src
attribute.
Upvotes: 2
Views: 446
Reputation: 3251
You can use image_path:
ActionController::Base.helpers.image_path("diane.png")
Upvotes: 4