I have a file data.txt
in the public
folder of my Rails project. I want to link to it from one of the pages in my project using link_to
. How can I do it?
If I do
<%= link_to "here", "data.txt" %>
it links to domain.com/data.txt
instead of domain.com/my_project/data.txt
.
This worked for me:
<%= link_to 'Sitemap', root_url+'my_sitemap.svg', { target: '_blank' } %>