Skip to content

Commit

Permalink
make DocumentNotFound simpler to initialize
Browse files Browse the repository at this point in the history
[fixes #3198]
  • Loading branch information
arthurnn committed Aug 5, 2013
1 parent 88599cf commit ec44a18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mongoid/errors/document_not_found.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class DocumentNotFound < MongoidError
# @param [ Array ] unmatched The unmatched ids, if appropriate
def initialize(klass, params, unmatched = nil)
if !unmatched && !params.is_a?(Hash)
raise ArgumentError, 'please also supply the unmatched ids'
unmatched = Array(params)
end

@klass, @params = klass, params
super(
compose_message(
Expand Down

0 comments on commit ec44a18

Please sign in to comment.