Hi, I would like to get the root path of my website using link_to in a view... (for example : http://www.mywebsite/controller/action/id) how is that possible ? (i do need it, because i use the generated code in the view outside of the rails app'') Thanks.. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
guillaume wrote:> Hi, > > I would like to get the root path of my website using link_to in a > view... (for example : http://www.mywebsite/controller/action/id) > how is that possible ? > > (i do need it, because i use the generated code in the view outside of > the rails app'') > > Thanks..in routes.rb: map.root ''/'' in your view: link_to ''link to root'', root_url Is that what you need? -Sjoerd -- 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 -~----------~----~----~----~------~----~------~--~---
Or you could just do this: link_to "Link", "/" On Saturday October 25, 2008 12:01:19 pm Sjoerd Andringa wrote:> guillaume wrote: > > Hi, > > > > I would like to get the root path of my website using link_to in a > > view... (for example : http://www.mywebsite/controller/action/id) > > how is that possible ? > > > > (i do need it, because i use the generated code in the view outside of > > the rails app'') > > > > Thanks.. > > in routes.rb: > map.root ''/'' > > in your view: > link_to ''link to root'', root_url > > Is that what you need? > > -Sjoerd--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Patrick Sullivan wrote:> Or you could just do this: > > link_to "Link", "/"True, however won''t that just generate a relative url? So <a href="/">Link</a> instead of <a href="http://www.mysite.com/">Link</a>? I believe Guillaume requires the latter, as his views are also used outside of his app. -- 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 -~----------~----~----~----~------~----~------~--~---