Method: Mongoid::Errors::DocumentNotFound#initialize
- Defined in:
- lib/mongoid/errors/document_not_found.rb
#initialize(klass, params, unmatched = nil) ⇒ DocumentNotFound
Create the new error.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mongoid/errors/document_not_found.rb', line 26 def initialize(klass, params, unmatched = nil) if !unmatched && !params.is_a?(Hash) unmatched = Array(params) if params end @klass, @params = klass, params super( ( (params, unmatched), { klass: klass.name, searched: searched(params), attributes: params, total: total(params), missing: missing(unmatched), shard_key: shard_key(unmatched) } ) ) end |