How to create an anchor and redirect to this specific anchor in Ruby on Rails

Actually, anchor is an option for the path, not for the link_to

<%= link_to '#', post_path(comment.post, :anchor => "comment_#{comment.id}") %>

http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M001565

link_to "Comment wall", profile_path(@profile, :anchor => "wall")
       # => <a href="http://stackoverflow.com/profiles/1#wall">Comment wall</a>

Leave a Comment