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

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

Instance Method Summary collapse

Instance Method Details

Recreate the user based on the stored cookie



85
86
87
88
89
# File 'lib/devise/models/rememberable.rb', line 85

def serialize_from_cookie(cookie)
  rememberable_id, remember_token = cookie.split('::')
  rememberable = find_by_id(rememberable_id) if rememberable_id
  rememberable if rememberable.try(:valid_remember_token?, remember_token)
end

Create the cookie key using the record id and remember_token



80
81
82
# File 'lib/devise/models/rememberable.rb', line 80

def serialize_into_cookie(rememberable)
  "#{rememberable.id}::#{rememberable.remember_token}"
end