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
23
# 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.



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

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

#find(*args) ⇒ Object



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

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