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?
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Craig Jolicoeur wrote:> > link_to ''my_link'', "#{RAILS_ROOT}/public/foo.html" >That will create something like: <a href="/home/var/www/myapp/public/foo.html">my link</a> 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'' %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Alex Wayne wrote:> Craig Jolicoeur wrote: >> >> link_to ''my_link'', "#{RAILS_ROOT}/public/foo.html" >> > > That will create something like: > > <a href="/home/var/www/myapp/public/foo.html">my link</a> > > 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---