lib/devise/models/rememberable.rb in devise-1.0.11 vs lib/devise/models/rememberable.rb in devise-1.1.pre
- old
+ new
@@ -28,33 +28,30 @@
# User.serialize_into_cookie(user)
#
# # lookup the user based on the incoming cookie information
# User.serialize_from_cookie(cookie_string)
module Rememberable
+ extend ActiveSupport::Concern
- def self.included(base)
- base.class_eval do
- extend ClassMethods
-
- # Remember me option available in after_authentication hook.
- attr_accessor :remember_me
- end
+ included do
+ # Remember me option available in after_authentication hook.
+ attr_accessor :remember_me
end
# Generate a new remember token and save the record without validations.
def remember_me!
self.remember_token = Devise.friendly_token
self.remember_created_at = Time.now.utc
- save(false)
+ save(:validate => false)
end
# Removes the remember token only if it exists, and save the record
# without validations.
def forget_me!
if remember_token
self.remember_token = nil
self.remember_created_at = nil
- save(false)
+ save(:validate => false)
end
end
# Checks whether the incoming token matches or not with the record token.
def valid_remember_token?(token)