Module: Mongoid

Defined in:
lib/mongoid/field.rb,
lib/mongoid.rb,
lib/mongoid/errors.rb,
lib/mongoid/finders.rb,
lib/mongoid/commands.rb,
lib/mongoid/criteria.rb,
lib/mongoid/document.rb,
lib/mongoid/attributes.rb,
lib/mongoid/timestamps.rb,
lib/mongoid/versioning.rb,
lib/mongoid/associations.rb,
lib/mongoid/commands/save.rb,
lib/mongoid/dynamic_finder.rb,
lib/mongoid/commands/create.rb,
lib/mongoid/commands/delete.rb,
lib/mongoid/commands/destroy.rb,
lib/mongoid/associations/proxy.rb,
lib/mongoid/commands/delete_all.rb,
lib/mongoid/associations/has_one.rb,
lib/mongoid/associations/options.rb,
lib/mongoid/commands/destroy_all.rb,
lib/mongoid/associations/has_many.rb,
lib/mongoid/associations/belongs_to.rb,
lib/mongoid/extensions/hash/accessors.rb,
lib/mongoid/extensions/array/accessors.rb,
lib/mongoid/extensions/date/conversions.rb,
lib/mongoid/extensions/hash/conversions.rb,
lib/mongoid/extensions/time/conversions.rb,
lib/mongoid/associations/has_one_related.rb,
lib/mongoid/extensions/array/conversions.rb,
lib/mongoid/extensions/float/conversions.rb,
lib/mongoid/extensions/hash/assimilation.rb,
lib/mongoid/associations/has_many_related.rb,
lib/mongoid/extensions/array/assimilation.rb,
lib/mongoid/extensions/object/conversions.rb,
lib/mongoid/extensions/string/conversions.rb,
lib/mongoid/extensions/string/inflections.rb,
lib/mongoid/extensions/symbol/inflections.rb,
lib/mongoid/extensions/array/parentization.rb,
lib/mongoid/extensions/boolean/conversions.rb,
lib/mongoid/extensions/integer/conversions.rb,
lib/mongoid/associations/belongs_to_related.rb,
lib/mongoid/extensions/datetime/conversions.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Associations, Attributes, Commands, Errors, Extensions, Finders, Timestamps, Versioning Classes: Criteria, Document, DynamicFinder, Field

Class Method Summary collapse

Class Method Details

.databaseObject

Returns the Mongo::DB to use or raise an error if none was set.



62
63
64
# File 'lib/mongoid.rb', line 62

def self.database
  @database || (raise Errors::InvalidDatabase.new("No database has been set, please use Mongoid.database="))
end

.database=(db) ⇒ Object

Sets the Mongo::DB to be used.



56
57
58
59
# File 'lib/mongoid.rb', line 56

def self.database=(db)
  raise Errors::InvalidDatabase.new("Database should be a Mongo::DB, not #{db.class.name}") unless db.kind_of?(Mongo::DB)
  @database = db
end