Exception: Mongoid::Errors::DocumentNotFound
- Inherits:
-
MongoidError
- Object
- StandardError
- MongoidError
- Mongoid::Errors::DocumentNotFound
- Defined in:
- lib/mongoid/errors/document_not_found.rb
Overview
Raised when querying the database for a document by a specific id which does not exist. If multiple ids were passed then it will display all of those.
Constant Summary
Constants inherited from MongoidError
Instance Attribute Summary collapse
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
-
#initialize(klass, ids) ⇒ DocumentNotFound
constructor
A new instance of DocumentNotFound.
Methods inherited from MongoidError
Constructor Details
#initialize(klass, ids) ⇒ DocumentNotFound
Returns a new instance of DocumentNotFound.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mongoid/errors/document_not_found.rb', line 15 def initialize(klass, ids) @klass = klass @identifiers = ids.is_a?(Array) ? ids.join(", ") : ids super( translate( "document_not_found", { :klass => klass.name, :identifiers => identifiers } ) ) end |
Instance Attribute Details
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
13 14 15 |
# File 'lib/mongoid/errors/document_not_found.rb', line 13 def identifiers @identifiers end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
13 14 15 |
# File 'lib/mongoid/errors/document_not_found.rb', line 13 def klass @klass end |