Method: Devise::Controllers::SignInOut#sign_out_all_scopes

Defined in:
lib/devise/controllers/sign_in_out.rb

#sign_out_all_scopes(lock = true) ⇒ Object

Sign out all active users or scopes. This helper is useful for signing out all roles in one click. This signs out ALL scopes in warden. Returns true if there was at least one logout and false if there was no user logged in on all scopes.



95
96
97
98
99
100
101
102
103
104
# File 'lib/devise/controllers/sign_in_out.rb', line 95

def sign_out_all_scopes(lock = true)
  users = Devise.mappings.keys.map { |s| warden.user(scope: s, run_callbacks: false) }

  warden.logout
  expire_data_after_sign_out!
  warden.clear_strategies_cache!
  warden.lock! if lock

  users.any?
end