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

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'