Reputation: 4081
I created an anchor <a name="anchor"></a>
on a different page than the link:
<%= link_to image_tag('/assets/image.png'), newpage_path,:anchor => "anchor" %>
This links to the newpage_path, but starts all the way on top, it's not linking to the anchor. What am I missing?
Upvotes: 0
Views: 474
Reputation: 18037
You can (and should) still use a named route for this. Try this:
<%= link_to image_tag('/assets/image.png'), newpage_path(:anchor => "anchor") %>
Search this page for the text anchor
for documentation on this: http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to
Upvotes: 1
Reputation: 7339
Try this
<%= link_to image_tag('/assets/image.png'), {:controller => "newpage", :anchor => "anchor"}, :class => "yourstyle" %>
Upvotes: 1