Cra*_*uff 5 devise ruby-on-rails-3 activeadmin
我正在使用Devise作为我的用户模型.我也在使用ActiveAdmin,它也使用Devise以及AdminUser模型.
我可以使用admin_user和用户彼此独立登录,但我注意到如果我退出用户,AdminUser也会退出.如果我将其反转并首先注销AdminUser,也会发生同样的事情.
我有什么办法可以解决这个问题呢?
的routes.rb
devise_for :admin_users, ActiveAdmin::Devise.config
devise_for :users
get "dashboard/home"
Run Code Online (Sandbox Code Playgroud)
ApplicationController的
protected
def after_sign_in_path_for(resource)
if resource.is_a?(User)
stored_location_for(:user) || dashboard_home_path
elsif resource.is_a?(AdminUser)
stored_location_for(:admin_user) || admin_root_path(resource)
end
end
Run Code Online (Sandbox Code Playgroud)
您正在寻找的是一个名为Devise的配置 sign_out_all_scopes
当用户注销并且设置为true时,将为该用户(包括用户和管理员)注销所有范围.
在devise.rb中搜索sign_out_all_scopes并将其值更改为true.
归档时间: |
|
查看次数: |
463 次 |
最近记录: |