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.



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

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

Instance Method Details

#messageObject



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

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