I feel like I’m doing something stupid, because I haven’t been able to
fix this.

I have this in my routes.rb file:

map.resources :networks, :has_many => :nodes
map.resources :auth
map.connect ‘users/login’, :controller => ‘users’, :action =>
map.resources :users
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’

I’m trying to generate an url that goest to localhost:3000/users/
login … but no matter what I do, that url always tries to work
through the “show” action as opposed to the “login” action I have in
the users controller.

What am I doing wrong?

hi justin,
my first guess is that are not reloading the routing table after
making the change. Remember to restart the server for new routes to
take effect. When I check in my code, your route just works fine.


Add the line

map.connect ‘users/login’, :controller => ‘users’, :action => ‘login’


map.resources :users

in your routes.rb

Why should that work? Routes are consulted in the order they are
defined in routes.rb. So if you have
map.resources :users
map.connect ‘/users/login’
it will catch the ‘/users/:id’ declaration of the RESTful resource
routes and always get justin to the show action before it even reaches
the ‘/users/login’ declaration.


thats right. the order is from top to bottom. It was my mistake.