I need to have path like “#privacy” for tab plugin. Link must contain only anchor. When I use link_to 'Privacy', :anchor => 'privacy' Rails generate /privacy#privacy – link, that contains full path and anchor.
How can I told Rails to generate url without path (only anchor)?
Thanks.
Solved: link_to 'Privacy', '#privacy'
The following will create a link the way you want –
In most browsers, the path of the current page will be prefixed, but if you check the source of the page, the following html will be seen –
This will most probably serve your purpose for the UI, just that you’ll have to split the url at ‘#’ using Javascript.