我想在用户点击“发送密码重置说明”按钮后重定向到自定义路径。
我遵循了这个https://github.com/plataformatec/devise/wiki/How-To:-Redirect-URL-after-sending-reset-password-instructions,但现在它的工作原理如下:
PasswordsController代码:
class PasswordsController < Devise::PasswordsController
def after_sending_reset_password_instructions_path_for(resource_name)
redirect_to root_path and return
end
end
routes.rb中:
devise_for :users, :path => 'konto', :controllers => {:registrations => 'users/registrations', :passwords => 'passwords'}, :skip => [:confirmations, :passwords, :registrations, :sessions, :unlocks]
as :user do
get 'konto/potwierdzenie/nowe' => 'devise/confirmations#new', as: :new_user_confirmation
get 'konto/potwierdzenie' => 'devise/confirmations#show'
post 'konto/potwierdzenie' => 'devise/confirmations#create', as: :user_confirmation
get 'konto/haslo/nowe' => 'devise/passwords#new', as: :new_user_password
get 'konto/haslo/edycja' => 'devise/passwords#edit', as: :edit_user_password
post 'konto/haslo' => 'devise/passwords#create', as: :user_password
put 'konto/haslo' => 'devise/passwords#update'
get 'rejestracja' => 'users/registrations#new', as: :new_user_registration
post 'rejestracja' => 'users/registrations#create', as: :user_registration
get 'konto/edycja' => 'users/registrations#edit', as: :edit_user_registration
put 'konto/edycja' => 'users/registrations#update'
get 'konto/anulowanie' => 'users/registrations#cancel', as: :cancel_user_registration
delete 'rejestracja' => 'users/registrations#destroy'
get 'logowanie' => 'devise/sessions#new', as: :new_session
post 'logowanie' => 'devise/sessions#create', as: :user_session
get 'wylogowanie' => 'devise/sessions#destroy', as: :destroy_session
get 'konto/odblokowanie/nowe' => 'devise/unlocks#new', as: :new_user_unlock
get 'konto/odblokowanie' => 'devise/unlocks#show'
post 'konto/odblokowanie' => 'devise/unlocks#create', as: :user_unlock
get 'konto/auth/:provider' => 'users/omniauth_callbacks#passthru'
end
我做错了什么?