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 or by set of attributes which does not exist. If multiple ids were passed then it will display all of those.
Constant Summary
Constant Summary
Constants inherited from MongoidError
Instance Attribute Summary (collapse)
-
- (Object) params
readonly
Returns the value of attribute params.
Instance Method Summary (collapse)
-
- (DocumentNotFound) initialize(klass, params, unmatched = nil)
constructor
Create the new error.
Methods inherited from MongoidError
#compose_message, #problem, #resolution, #summary, #translate
Constructor Details
- (DocumentNotFound) initialize(klass, params, unmatched = nil)
Create the new error.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mongoid/errors/document_not_found.rb', line 23 def initialize(klass, params, unmatched = nil) if !unmatched && !params.is_a?(Hash) raise ArgumentError, 'please also supply the unmatched ids' end super( ( (params), { klass: klass.name, searched: searched(params), attributes: params, total: total(params), missing: missing(unmatched) } ) ) end |
Instance Attribute Details
- (Object) params (readonly)
Returns the value of attribute params
10 11 12 |
# File 'lib/mongoid/errors/document_not_found.rb', line 10 def params @params end |