这就是问题,我有一个Rails应用程序,可以使用devise_invitable邀请其他用户。
目前,我有这条路线(使用devise和devise_invitable)
devise_for :admin_users, controllers: {
sessions: 'admin_users/sessions',
passwords: 'admin_users/passwords',
invitations: 'admin_users/invitations'
},
path: '',
path_names: {
sign_in: "admin/login",
sign_out: "admin/logout",
password: "password_reset"
}
devise_scope :admin_users do
get '/invitation/confirm', to: 'admin_users/invitations#confirm'
end
电子邮件邀请已完全正常运行,但是我想在单击接受按钮之后将用户重定向到Invitation_confirm_path。
我认为错误与路线有关。 单击接受邀请按钮后如何创建自定义路径?
URL: /invitation/confirm.6?invitation_token=LGztwvxdxL1VmCtfHmYH
Error: Could not find devise mapping for path "/invitation/confirm.6?invitation_token=LGztwvxdxL1VmCtfHmYH". This may happen for two reasons: 1) You forgot to wrap your route inside the scope block. For example: devise_scope :user do get "/some/route" => "some_devise_controller" end 2) You are testing a Devise controller bypassing the router. If so, you can explicitly tell Devise which mapping to use: @request.env["devise.mapping"] = Devise.mappings[:user]