Module: Locomotive::Concerns::Account::DevisePatch::ClassMethods

Defined in:
app/models/locomotive/concerns/account/devise_patch.rb

Instance Method Summary collapse

Instance Method Details

#serialize_from_session(key, salt) ⇒ Object



12
13
14
15
16
17
18
# File 'app/models/locomotive/concerns/account/devise_patch.rb', line 12

def serialize_from_session(key, salt)
  (key = key.first) if key.kind_of? Array
  (key = BSON::ObjectId.from_string(key['$oid'])) if key.kind_of? Hash

  record = to_adapter.get(key)
  record if record && record.authenticatable_salt == salt
end

#serialize_into_session(record) ⇒ Object



20
21
22
# File 'app/models/locomotive/concerns/account/devise_patch.rb', line 20

def serialize_into_session(record)
  [record.id.to_s, record.authenticatable_salt]
end