Module: Devise::Orm::MongoMapper

Includes:
Schema
Defined in:
lib/devise/orm/mongo_mapper.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Schema

#authenticatable, #confirmable, #lockable, #recoverable, #rememberable, #token_authenticatable, #trackable

Class Method Details

.included_modules_hook(klass) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/devise/orm/mongo_mapper.rb', line 14

def self.included_modules_hook(klass)
  klass.send :extend,  self
  klass.send :include, InstanceMethods
  yield

  klass.devise_modules.each do |mod|
    klass.send(mod) if klass.respond_to?(mod)
  end
end

Instance Method Details

#apply_schema(name, type, options = {}) ⇒ Object

Tell how to apply schema methods. This automatically converts DateTime to Time, since MongoMapper does not recognize the former.



40
41
42
43
44
# File 'lib/devise/orm/mongo_mapper.rb', line 40

def apply_schema(name, type, options={})
  return unless Devise.apply_schema
  type = Time if type == DateTime
  key name, type, options
end

#find(*args) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/devise/orm/mongo_mapper.rb', line 24

def find(*args)
  options = args.extract_options!
  case args.first
    when :first
      first(options)
    when :all
      all(options)
    else
      super
  end
end