Exception: Mongoid::Errors::DocumentNotFound
- Inherits:
-
MongoidError
- Object
- StandardError
- MongoidError
- Mongoid::Errors::DocumentNotFound
- Defined in:
- build/mongoid-6.1/lib/mongoid/errors/document_not_found.rb
Overview
Raised when querying the database for a document by a specific id or by set of attributes 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
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Attributes inherited from MongoidError
#problem, #resolution, #summary
Instance Method Summary collapse
-
#initialize(klass, params, unmatched = nil) ⇒ DocumentNotFound
constructor
Create the new error.
Methods inherited from MongoidError
Constructor Details
#initialize(klass, params, unmatched = nil) ⇒ DocumentNotFound
Create the new error.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'build/mongoid-6.1/lib/mongoid/errors/document_not_found.rb', line 23 def initialize(klass, params, unmatched = nil) if !unmatched && !params.is_a?(Hash) unmatched = Array(params) end @klass, @params = klass, params super( ( (params), { klass: klass.name, searched: searched(params), attributes: params, total: total(params), missing: missing(unmatched) } ) ) end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
10 11 12 |
# File 'build/mongoid-6.1/lib/mongoid/errors/document_not_found.rb', line 10 def klass @klass end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
10 11 12 |
# File 'build/mongoid-6.1/lib/mongoid/errors/document_not_found.rb', line 10 def params @params end |