Rails link to file in public folder
This worked for me:
<%= link_to 'Sitemap', root_url+'my_sitemap.svg', { target: '_blank' } %>
It sounds like you want to access the file here:
<%= link_to "here", "/my_project/data.txt" %>
I'd go with:
link_to 'Download sample', root_path + 'data/invoices/sample.pdf'
Update 2018-08-09
- Performance does not matter if you generate single link (benchmark it if you many of them)
- Probably
"#{root_path}data/invoices/sample.pdf"
is much simpler