Module: Authentication::Logic::ActsAsAuthentic::SessionMaintenance::Methods

Defined in:
lib/auth/logic/acts_as_authentic/session_maintenance.rb

Overview

This module, as one of the ‘acts_as_authentic_modules`, is only included into an ActiveRecord model if that model calls `acts_as_authentic`.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



89
90
91
92
93
94
# File 'lib/auth/logic/acts_as_authentic/session_maintenance.rb', line 89

def self.included(klass)
  klass.class_eval do
    before_save :get_session_information, if: :update_sessions?
    before_save :maintain_sessions, if: :update_sessions?
  end
end

Instance Method Details

#save_without_session_maintenance(**options) ⇒ Object

Save the record and skip session maintenance all together.



97
98
99
100
101
102
# File 'lib/auth/logic/acts_as_authentic/session_maintenance.rb', line 97

def save_without_session_maintenance(**options)
  self.skip_session_maintenance = true
  result = save(**options)
  self.skip_session_maintenance = false
  result
end