ruben.pierich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Apr-13 13:56 UTC
Route namespace and link_to.
Hello,
In my routes.rb file I have a namespace declared:
map.namespace(:admin) do |admin|
admin.resources :pictures
admin.resources :admins
end
then in my erb template for the admin/admins controller I have a
link_to tag as follows:
<%= link_to "Login", :controller => "login", :action
=> "login" %>
Unfortunately this is giving me the path /admin/login/login instead of
the correct /login/login is there anyway to stop that admin namespace
from being inserted into the path?
Thanks,
Ruben
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
the simplest way would be: <%= link_to "Login", :controller => "/login", :action => "login" %> # "/login" rather than just "login" however if you''re using one of the many authentication plugins out there, you''re more likely to want to add these to your routes: map.logout ''/logout'', :controller => ''sessions'', :action => ''destroy'' map.login ''/login'', :controller => ''sessions'', :action => ''new'' -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.