Reputation: 3638
I want to display text that links to a image that opens a new window (_target), but I don't know the Rails 3 way of doing that. All of my searches have just yielded making the image the link (ie link to(image_tag....)), but that's not what I want to do.
What I'm looking to do is display the text link "Click here to see an example" to the image "example.gif" in my assets/images folder.
I tried:
<%= link_to "Click here to see an example", image_tag("example.gif"), :target => "_blank" %>
but that didn't work. Thanks!
Upvotes: 0
Views: 735
Reputation: 10395
Like this :
<%= link_to "Click here to see an example", image_path("example.gif"), :target => "_blank" %>
Upvotes: 3