在Heroku上运行的My Rails 5应用程序使用Devise进行身份验证,目前已嵌套。在routes.rb中看起来像这样:
resources :teams do
member do
get :about
get :foundation
end
devise_for :users, :path_prefix => 'auth',
:controllers => {
:masquerades => "admin/masquerades",
:registrations => "registrations",
:sessions => "sessions",
:password => "passwords"
}
当我尝试设置忘记密码时,错误路由出错后会收到错误,因为设计的所有标准都指向new_user_session_path
而不是new_user_team_session_path
。
目前我收到此错误:undefined method new_user_session_path for <ActionDispatch::Routing::RoutesProxy:0x007fd6e50b1328>
我的想法是生成设计视图和控制器并修复所有链接。但是,当前错误不会出现在我从源代码中获取的密码控制器中:https://github.com/plataformatec/devise/blob/master/app/controllers/devise/passwords_controller.rb
我的问题是:我想添加一个重置密码&#39;功能和嵌套的Devise路由。我该如何解决这个问题?
编辑:
以下是rake routes
的输出:
new_user_team_session GET /auth/users/teams/:team_id/sign_in(.:format) sessions#new
user_team_session POST /auth/users/teams/:team_id/sign_in(.:format) sessions#create
destroy_user_team_session DELETE /auth/users/teams/:team_id/sign_out(.:format) sessions#destroy
new_user_team_password GET /auth/users/teams/:team_id/password/new(.:format) devise/passwords#new
edit_user_team_password GET /auth/users/teams/:team_id/password/edit(.:format) devise/passwords#edit
user_team_password PATCH /auth/users/teams/:team_id/password(.:format) devise/passwords#update
PUT /auth/users/teams/:team_id/password(.:format) devise/passwords#update
POST /auth/users/teams/:team_id/password(.:format) devise/passwords#create
cancel_user_team_registration GET /auth/users/teams/:team_id/cancel(.:format) registrations#cancel
new_user_team_registration GET /auth/users/teams/:team_id/sign_up(.:format) registrations#new
edit_user_team_registration GET /auth/users/teams/:team_id/edit(.:format) registrations#edit
user_team_registration PATCH /auth/users/teams/:team_id(.:format) registrations#update
PUT /auth/users/teams/:team_id(.:format) registrations#update
DELETE /auth/users/teams/:team_id(.:format) registrations#destroy
POST /auth/users/teams/:team_id(.:format) registrations#create
back_user_team_masquerade_index GET /auth/users/teams/:team_id/masquerade/back(.:format) admin/masquerades#back
user_team_masquerade GET /auth/users/teams/:team_id/masquerade/:id(.:format) admin/masquerades#show
干杯