Link_to static html problem

I’m having trouble linking to a static HTML page using rails link_to
helper.

I have the page foo.html in my RAILS_ROOT/public/ directory and if i try
to access the page manually by url www.mysite.com/foo it works fine.

but i’m trying to link to that file with rails link_to and it doesnt
work.

link_to ‘my_link’, “#{RAILS_ROOT}/public/foo.html”

this gives me a Routing Error trying to load the static file.

what am I doing wrong here?

Craig J. wrote:

link_to ‘my_link’, “#{RAILS_ROOT}/public/foo.html”

That will create something like:

my link

this is ibviously not what you want. The link_to helper only wants the
public path to your file, not the absolute path to the file on the disk.
You are way over thinking this.

<%= link_to ‘my link’, ‘/foo.html’ %>

Alex W. wrote:

Craig J. wrote:

link_to ‘my_link’, “#{RAILS_ROOT}/public/foo.html”

That will create something like:

my link

this is ibviously not what you want. The link_to helper only wants the
public path to your file, not the absolute path to the file on the disk.
You are way over thinking this.

<%= link_to ‘my link’, ‘/foo.html’ %>

perfect. thanks for the quick response.