lib/mongoid.rb in mongoid-0.10.3 vs lib/mongoid.rb in mongoid-0.10.4
- old
+ new
@@ -39,10 +39,11 @@
require "mongo"
require "mongoid/associations"
require "mongoid/associations/options"
require "mongoid/attributes"
require "mongoid/commands"
+require "mongoid/config"
require "mongoid/complex_criterion"
require "mongoid/criteria"
require "mongoid/dynamic_finder"
require "mongoid/extensions"
require "mongoid/errors"
@@ -50,19 +51,15 @@
require "mongoid/finders"
require "mongoid/timestamps"
require "mongoid/versioning"
require "mongoid/document"
-module Mongoid
+module Mongoid #:nodoc
- # Sets the Mongo::DB to be used.
- 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
-
- # Returns the Mongo::DB to use or raise an error if none was set.
- def self.database
- @database || (raise Errors::InvalidDatabase.new("No database has been set, please use Mongoid.database="))
+ class << self
+ #direct all calls to the configuration
+ def method_missing(name, *args)
+ Config.instance.send(name, *args)
+ end
end
end