[英]Rails Devise Article from wiki throws error: undefined local variable or method `authenticated_user_root_path'
我想在我的 rails 6 应用程序中添加一个管理员和用户部分,阅读本教程https://github.com/heartcombo/devise/wiki/How-to-Setup-Multiple-Devise-User-Models#
尝试以用户身份登录时出现以下错误:
undefined local variable or method `authenticated_user_root_path' for #<Users::SessionsController:0x000000000824bbe0> Did you mean? authenticate_user!
这部分可以在 wiki 文章的第 6 部分中找到。
我在这里做错了什么?
我认为您应该在您的 routes.rb 中手动定义“authenticated_user_root”
authenticated :user do
root 'pages#index', as: :authenticated_user_root
end
您还可以为管理员定义另一个:
authenticated :admin do
root 'admin_pages#index', as: :authenticated_admin_root
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.