lib/mongoid/finders.rb in mongoid-2.0.0.beta.18 vs lib/mongoid/finders.rb in mongoid-2.0.0.beta.19
- old
+ new
@@ -61,10 +61,10 @@
#
# <tt>Person.find(:all, :conditions => { :attribute => "value" })</tt>
#
# <tt>Person.find(Mongo::ObjectID.new.to_s)</tt>
def find(*args)
- raise Errors::InvalidOptions.new("Calling Document#find with nil is invalid") if args[0].nil?
+ raise Errors::InvalidOptions.new(:calling_document_find_with_nil_is_invalid, {}) if args[0].nil?
type = args.delete_at(0) if args[0].is_a?(Symbol)
criteria = Criteria.translate(self, *args)
case type
when :first then return criteria.one
when :last then return criteria.last