suely
suely

Reputation: 434

change routes in devise

Im working with ruby 1.9.2, rails 3.1.3, devise 1.5.3, I need to change the devise routes, I already changed the default routes, like login and logout, but I need to change the others routes, for example:

http://localhost:3000/password/new

I need that, when the user click the link did you forget your password? go to:

http://localhost:3000/recovery_password

in my routes I tried:

get "recovery_password", :to => "devise/passwords#new"                                    
get 'recovery_password' => 'devise_passwords#new', :as => :new_user_password

but don't works, please help.

thanks in advance.

Upvotes: 1

Views: 275

Answers (1)

Rafaiel
Rafaiel

Reputation: 302

try this. It should works. ;)

# change :devise_model to :users, or :admins or any name of your devise model 
devise_for :devise_model do
    get 'recovery_password' => "devise/passwords#new"
end

and you can use this in view like this.

link_to 'Forgot you password?', recovery_password_url

PS. if you have customize devise controller. You should tell the router first, and change devise controller to your customize controller name.

Upvotes: 1

Related Questions