lib/sorcery/model/submodules/remember_me.rb in sorcery-0.7.0 vs lib/sorcery/model/submodules/remember_me.rb in sorcery-0.7.1
- old
+ new
@@ -22,11 +22,14 @@
end
base.send(:include, InstanceMethods)
base.sorcery_config.after_config << :define_remember_me_mongoid_fields if defined?(Mongoid) and base.ancestors.include?(Mongoid::Document)
-
+ if defined?(MongoMapper) and base.ancestors.include?(MongoMapper::Document)
+ base.sorcery_config.after_config << :define_remember_me_mongo_mapper_fields
+ end
+
base.extend(ClassMethods)
end
module ClassMethods
protected
@@ -34,9 +37,13 @@
def define_remember_me_mongoid_fields
field sorcery_config.remember_me_token_attribute_name, :type => String
field sorcery_config.remember_me_token_expires_at_attribute_name, :type => Time
end
+ def define_remember_me_mongo_mapper_fields
+ key sorcery_config.remember_me_token_attribute_name, String
+ key sorcery_config.remember_me_token_expires_at_attribute_name, Time
+ end
end
module InstanceMethods
# You shouldn't really use this one yourself - it's called by the controller's 'remember_me!' method.
def remember_me!
\ No newline at end of file