map.resources creates routes for the typical CRUD operations. Since you are adding an additional operation, you could revise your mapping to this:
map.resources :users, :collection => {:sign_in => :get} This creates awkward route names & feels ugly as you are mucking with a resource controller's routes. It's probably better to do: map.sign_in "/sign_in", :controller => "users", :action => "sign_in" However, as logging in is really a session issue, rather than a user concern, it would be even better to do something like this: map.sign_in "/sign_in", :controller => "sessions", :action => "new" Then move your sign_in method from users_controller to sessions_controller You will want a file like /path_to_controller_views/sign_in.html.erb to handle it (assuming you are using erb). Replace path_to_controller_views with either /app/views/users or /app/views/sessions as appropriate. Niels On Jul 5, 2010, at 10:02 PM, RichardOnRails wrote: > I've got the following in config\routes.rb: > map.resources :users > > In app\views\shared\_menu.erb, I've got: > Please sign in <%= link_to > "here", :controller=>"user", :action=>"sign_in" -%> > > In app\controllers\users_controller.rb > def sign_in > end > > When I run the application, I crash with: > Routing Error > No route matches "/user/sign_in" with {:method=>:get} > > I presume I should add "def sign_in; [snip]; end" somewhere in: > app\views\users > > But where, so as to satisfy the Rails routing scheme? > Is sufficient information provided above to answer this question? > I'm running Rails 2.3.5 > > Thanks in Advance, > Richard > > -- > 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-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.