Module: Devise::Models::Rememberable::ClassMethods

Defined in:
lib/devise/models/rememberable.rb

Instance Method Summary collapse

Instance Method Details

#remember_tokenObject

Generate a token checking if one does not already exist in the database.



117
118
119
# File 'lib/devise/models/rememberable.rb', line 117

def remember_token #:nodoc:
  generate_token(:remember_token)
end

Recreate the user based on the stored cookie



111
112
113
114
# File 'lib/devise/models/rememberable.rb', line 111

def serialize_from_cookie(id, remember_token)
  record = to_adapter.get(id)
  record if record && record.rememberable_value == remember_token && !record.remember_expired?
end

Create the cookie key using the record id and remember_token



106
107
108
# File 'lib/devise/models/rememberable.rb', line 106

def serialize_into_cookie(record)
  [record.to_key, record.rememberable_value]
end