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.
Create the new error.
@example Create the error.
DocumentNotFound.new(Person, ["1", "2"])
@example Create the error with attributes instead of ids
DocumentNotFound.new(Person, :ssn => "1234", :name => "Helen")
@param [ Class ] klass The model class. @param [ Hash, Array, Object ] params The attributes or ids. @param [ Array ] unmatched The unmatched ids, if appropriate
# File lib/mongoid/errors/document_not_found.rb, line 22 def initialize(klass, params, unmatched = nil) if !unmatched && !params.is_a?(Hash) raise ArgumentError, 'please also supply the unmatched ids' end @klass, @params = klass, params super( compose_message( message_key(params), { klass: klass.name, searched: searched(params), attributes: params, total: total(params), missing: missing(unmatched) } ) ) end
Generated with the Darkfish Rdoc Generator 2.