Module: Devise::Orm::Mongoid

Includes:
Schema
Defined in:
lib/devise/orm/mongoid.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



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/devise/orm/mongoid.rb', line 32

def self.included_modules_hook(klass)
  klass.send :extend,  self
  # TODO: it's a little hack. Patch pull on master
  klass.send :include, InstanceMethods
  klass.send :include, ::Mongoid::Timestamps

  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.



50
51
52
53
54
# File 'lib/devise/orm/mongoid.rb', line 50

def apply_schema(name, type, options={})
  return unless Devise.apply_schema
  type = Time if type == DateTime
  field name, {:type => type}.merge(options)
end