Sha256: c61d895164696913afcfccd73c0f9c8a1d00c8ec1dc181a3a62f5567a1b17840

Contents?: true

Size: 775 Bytes

Versions: 4

Compression:

Stored size: 775 Bytes

Contents

require 'devise/serializers/base'

module Devise
  module Serializers
    class Rememberable < Warden::Serializers::Cookie
      include Devise::Serializers::Base

      def store(record, scope)
        remember_me = params[scope].try(:fetch, :remember_me, nil)
        if Devise::TRUE_VALUES.include?(remember_me) && record.respond_to?(:remember_me!)
          record.remember_me!
          super
        end
      end

      def default_options(record)
        super.merge!(:expires => record.remember_expires_at)
      end

      def delete(scope, record=nil)
        if record && record.respond_to?(:forget_me!)
          record.forget_me!
          super
        end
      end
    end
  end
end

Warden::Serializers.add(:rememberable, Devise::Serializers::Rememberable)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devise-0.7.3 lib/devise/serializers/rememberable.rb
devise-0.7.2 lib/devise/serializers/rememberable.rb
devise-0.7.1 lib/devise/serializers/rememberable.rb
devise-0.7.0 lib/devise/serializers/rememberable.rb