Permalink
Browse files

Delegate finder criteria methods

  • Loading branch information...
1 parent 121eac9 commit 482a95f265ebcafc4d2359b8b23943df123293e6 @bernerdschaefer bernerdschaefer committed Jun 29, 2011
Showing with 5 additions and 7 deletions.
  1. +5 −7 lib/mongoid/finders.rb
View
@@ -7,13 +7,11 @@ module Finders
# Delegate to the criteria methods that are natural for creating a new
# criteria.
- [ :all_in, :any_in, :any_of, :asc, :ascending, :avg, :desc, :descending,
- :excludes, :limit, :max, :min, :not_in, :only, :order_by,
- :skip, :sum, :without, :where, :update, :update_all, :near ].each do |name|
- define_method(name) do |*args|
- criteria.send(name, *args)
- end
- end
+ critera_methods = [ :all_in, :any_in, :any_of, :asc, :ascending, :avg,
+ :desc, :descending, :excludes, :limit, :max, :min,
+ :not_in, :only, :order_by, :skip, :sum, :without,
+ :where, :update, :update_all, :near ]
+ delegate *(critera_methods.dup << {:to => :criteria})
# Find all documents that match the given conditions.
#

0 comments on commit 482a95f

Please sign in to comment.