Folks,
I am using the restful_authentication plugin. This creates the users controller which is declared as a resource in routes.rb as below
map.resources :users
Now in the UsersController I have created an action to resetpwd that I am trying to get to from the login page when the user clicks "forgot password". However, when I do that the log file tells me that the call to /users/resetpwd gets resolved to the "show" action of the controller with id="resetpwd" as below
Processing UsersController#show (for 127.0.0.1 at 2009-04-30 21:05:13) [GET] Parameters: {"id"=>"resetpwd"} SQL (0.0ms) SET NAMES 'utf8' SQL (0.0ms) SET SQL_AUTO_IS_NULL=0
In the script/console when I list all the routes, here is a subset of what I get
GET /users/:id/ {:controller=>"users", :action=>"show"} GET /users/:id.:format/ {:controller=>"users", :action=>"show"}
That may explain why /users/resetpwd is mapping to the show action in UsersController because "resetpwd" is being taken as the :id for the GET action on /users. But when I run a recognize_path command as below in script/console it seems to resolve correctly
rs.recognize_path "/users/resetpwd"
=> {:controller=>"users", :action=>"resetpwd"}
I have two questions.
1. Why does recognize_path resolve to action "resetpwd" while when the code runs it resolves to action "show" with id="resetpwd"
2. How can I make the code resolve to action=> "resetpwd" in controller => users?
Thanks for your help. -S