Adding Hash parameter in the URL Rails Routes Adding Hash parameter in the URL Rails Routes ruby-on-rails ruby-on-rails

Adding Hash parameter in the URL Rails Routes


This is how you would usually do it:

link_to 'Click', my_path(anchor: 'sometext')

Your routes don't have much to do with it, since the anchor part (#something) is not transferred to the server, it's a pure client-side thing.


I recognize this is an old post, but I thought I would contribute my recent discovery:

<%= link_to "New Person", polymorphic_path([:new, person], anchor: "profile") %>

See the API Docs for details.