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



82
83
84
85
86
# File 'lib/devise/models/rememberable.rb', line 82

def serialize_from_cookie(cookie)
  record_id, record_token = cookie.split('::')
  record = find(:first, :conditions => { :id => record_id }) if record_id
  record if record.try(:valid_remember_token?, record_token)
end

Create the cookie key using the record id and remember_token



77
78
79
# File 'lib/devise/models/rememberable.rb', line 77

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