1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/lib/devise/orm/mongoid.rb

32 lines
716 B
Ruby
Raw Normal View History

2010-10-10 11:51:12 -04:00
require 'orm_adapter/adapters/mongoid'
module Devise
module Orm
module Mongoid
module Hook
def devise_modules_hook!
extend Schema
yield
return unless Devise.apply_schema
devise_modules.each { |m| send(m) if respond_to?(m, true) }
2009-11-13 19:33:00 -05:00
end
end
module Schema
include Devise::Schema
# Tell how to apply schema methods
def apply_devise_schema(name, type, options={})
type = Time if type == DateTime
field name, { :type => type }.merge!(options)
end
end
end
end
end
2010-03-29 18:29:57 -04:00
Mongoid::Document::ClassMethods.class_eval do
include Devise::Models
include Devise::Orm::Mongoid::Hook
end