Exception: Mongoid::Errors::DocumentNotFound

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

Overview

Raised when querying the database for a document by a specific id which does not exist.

Instance Method Summary collapse

Constructor Details

#initialize(klass, identifier) ⇒ DocumentNotFound

Returns a new instance of DocumentNotFound.



7
8
9
# File 'lib/mongoid/errors.rb', line 7

def initialize(klass, identifier)
  @klass, @identifier = klass, identifier
end

Instance Method Details

#messageObject



10
11
12
# File 'lib/mongoid/errors.rb', line 10

def message
  "Document not found for class #{@klass} and id #{@identifier}"
end