# module Devise::Controllers::Rememberable

A module that may be optionally included in a controller in order to provide remember me behavior.

### Public Class Methods

cookie_values() click to toggle source

Return default cookie values retrieved from session options.

    # File lib/devise/controllers/rememberable.rb, line 7
    def self.cookie_values
      Rails.configuration.session_options.slice(:path, :domain, :secure)
    end

### Public Instance Methods

forget_me(resource) click to toggle source

Forgets the given resource by deleting a cookie

    # File lib/devise/controllers/rememberable.rb, line 30
    def forget_me(resource)
      scope = Devise::Mapping.find_scope!(resource)
      resource.forget_me!
      cookies.delete("remember_#{scope}_token", forget_cookie_values(resource))
    end

remember_me(resource) click to toggle source

Remembers the given resource by setting up a cookie

    # File lib/devise/controllers/rememberable.rb, line 23
    def remember_me(resource)
      scope = Devise::Mapping.find_scope!(resource)
      resource.remember_me!(resource.extend_remember_period)
      cookies.signed["remember_#{scope}_token"] = remember_cookie_values(resource)
    end

### Protected Instance Methods

forget_cookie_values(resource) click to toggle source

    # File lib/devise/controllers/rememberable.rb, line 38
    def forget_cookie_values(resource)
      Devise::Controllers::Rememberable.cookie_values.merge!(resource.cookie_options)
    end

remember_cookie_values(resource) click to toggle source

    # File lib/devise/controllers/rememberable.rb, line 42
    def remember_cookie_values(resource)
      options = { :httponly => true }
      options.merge!(forget_cookie_values(resource))
      options.merge!(
        :value => resource.class.serialize_into_cookie(resource),
        :expires => resource.remember_expires_at
      )
    end