Sha256: 08bdf6fd102b2f06f1e460abafba938a3f3f0737ca7de3d6d6ee40cb38d94b3d

Contents?: true

Size: 1004 Bytes

Versions: 2

Compression:

Stored size: 1004 Bytes

Contents

module Devise
  module Orm
    module MongoMapper
      module InstanceMethods
        def save(options={})
          if options == false
            super(:validate => false)
          else
            super
          end
        end
      end

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

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

      include Devise::Schema

      # Tell how to apply schema methods. This automatically converts DateTime
      # to Time, since MongoMapper does not recognize the former.
      def apply_schema(name, type, options={})
        return unless Devise.apply_schema
        type = Time if type == DateTime
        key name, type, options
      end
    end
  end
end

MongoMapper::Document::ClassMethods.send(:include, Devise::Models)
MongoMapper::EmbeddedDocument::ClassMethods.send(:include, Devise::Models)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise-0.9.1 lib/devise/orm/mongo_mapper.rb
devise-0.9.0 lib/devise/orm/mongo_mapper.rb