My app has "users" for the main app and "admin_users" and the /admin Namespace.
When I'm logged into the /admin Namespace as an admin_user, and click "log out" - Devise logs me out of both Namespaces. How can I ensure that Devise only logs me out of that Namespace?
Routes.rb
devise_for :users, skip: :all
as :user do
get 'signin', to: 'devise/sessions#new', as: :new_user_session
post 'signin', to: 'devise/sessions#create', as: :user_session
delete 'signout', to: 'devise/sessions#destroy', as: :destroy_user_session
end
devise_for :admins, skip: :all
as :admin do
get 'admin/signin', to: 'admin/devise/sessions#new', as: :new_admin_session
post 'admin/signin', to: 'admin/devise/sessions#create', as: :admin_session
delete 'admin/signout', to: 'admin/devise/sessions#destroy', as: :destroy_admin_session
end
authenticate :admin do
namespace :admin do
...
end
end
set config.sign_out_all_scopes = false
in config/initializers/devise.rb
.
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
config.sign_out_all_scopes = false