Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add includes method to finders.rb

  • Loading branch information...
commit 90fa60db500795840bfbdaeb0fc706f6246711d9 1 parent 9d9b272
Richard Huang authored October 09, 2010
2  lib/mongoid/finders.rb
@@ -5,7 +5,7 @@ module Finders #:nodoc:
5 5
     # Delegate to the criteria methods that are natural for creating a new
6 6
     # criteria.
7 7
     [ :all_in, :any_in, :any_of, :asc, :ascending, :avg, :desc, :descending,
8  
-      :excludes, :limit, :max, :min, :not_in, :only, :order_by,
  8
+      :excludes, :includes, :limit, :max, :min, :not_in, :only, :order_by,
9 9
       :skip, :sum, :where, :near ].each do |name|
10 10
       define_method(name) do |*args|
11 11
         criteria.send(name, *args)
6  spec/integration/mongoid/criteria_spec.rb
@@ -81,10 +81,8 @@
81 81
     end
82 82
 
83 83
     it "with includes" do
84  
-      criteria = Person.all
85  
-      criteria.expects(:preload)
86  
-      criteria.eager_loadings = [:game]
87  
-      criteria.collect(&:game).collect(&:score).should == [10, 20]
  84
+      criteria = Person.includes(:game)
  85
+      criteria.collect(&:game).should == [person1.game, person2.game]
88 86
     end
89 87
   end
90 88
 

0 notes on commit 90fa60d

Please sign in to comment.
Something went wrong with that request. Please try again.