Exception: Mongoid::Errors::InvalidDatabase

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/mongoid/errors.rb

Overview

Raised when the database connection has not been set up properly, either by attempting to set an object on the db that is not a Mongo::DB, or not setting anything at all.

Example:

InvalidDatabase.new("Not a DB")

Instance Method Summary collapse

Constructor Details

#initialize(database) ⇒ InvalidDatabase

Returns a new instance of InvalidDatabase.



36
37
38
# File 'lib/mongoid/errors.rb', line 36

def initialize(database)
  @database = database
end

Instance Method Details

#messageObject



39
40
41
# File 'lib/mongoid/errors.rb', line 39

def message
  "Database should be a Mongo::DB, not #{@database.class.name}"
end