Module: Devise::Models::Rememberable::ClassMethods
- Defined in:
- lib/devise/models/rememberable.rb
Instance Method Summary collapse
-
#remember_token ⇒ Object
Generate a token checking if one does not already exist in the database.
-
#serialize_from_cookie(id, remember_token) ⇒ Object
Recreate the user based on the stored cookie.
-
#serialize_into_cookie(record) ⇒ Object
Create the cookie key using the record id and remember_token.
Instance Method Details
#remember_token ⇒ Object
Generate a token checking if one does not already exist in the database.
131 132 133 134 135 136 |
# File 'lib/devise/models/rememberable.rb', line 131 def remember_token #:nodoc: loop do token = Devise.friendly_token break token unless to_adapter.find_first({ remember_token: token }) end end |
#serialize_from_cookie(id, remember_token) ⇒ Object
Recreate the user based on the stored cookie
124 125 126 127 128 |
# File 'lib/devise/models/rememberable.rb', line 124 def (id, remember_token) record = to_adapter.get(id) record if record && !record.remember_expired? && Devise.secure_compare(record.rememberable_value, remember_token) end |
#serialize_into_cookie(record) ⇒ Object
Create the cookie key using the record id and remember_token
119 120 121 |
# File 'lib/devise/models/rememberable.rb', line 119 def (record) [record.to_key, record.rememberable_value] end |