Method: Devise::Controllers::Helpers#sign_out_all_scopes

Defined in:
lib/devise/controllers/helpers.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.



153
154
155
156
157
158
159
160
161
162
163
# File 'lib/devise/controllers/helpers.rb', line 153

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

  warden.raw_session.inspect
  warden.logout
  expire_devise_cached_variables!
  warden.clear_strategies_cache!
  warden.lock! if lock

  users.any?
end