User モデルに Devise を使用しています。AdminUserモデルにもDeviseを使用しているActiveAdminも使用しています。
admin_user とユーザーを別々に使用してサインインできますが、ユーザーをサインアウトすると、AdminUser もサインアウトされることに気付きました。それを逆にして最初に AdminUser をサインアウトすると、同じことが起こります。
うまくいけばこれを回避するにはどうすればよいですか?
ルート.rb
devise_for :admin_users, ActiveAdmin::Devise.config
devise_for :users
get "dashboard/home"
アプリケーションコントローラー
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