Skip to content
Browse files

add includes method to finders.rb

  • Loading branch information...
1 parent 9d9b272 commit 90fa60db500795840bfbdaeb0fc706f6246711d9 @flyerhzm committed
Showing with 3 additions and 5 deletions.
  1. +1 −1 lib/mongoid/finders.rb
  2. +2 −4 spec/integration/mongoid/criteria_spec.rb
View
2 lib/mongoid/finders.rb
@@ -5,7 +5,7 @@ module Finders #:nodoc:
# 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,
+ :excludes, :includes, :limit, :max, :min, :not_in, :only, :order_by,
:skip, :sum, :where, :near ].each do |name|
define_method(name) do |*args|
criteria.send(name, *args)
View
6 spec/integration/mongoid/criteria_spec.rb
@@ -81,10 +81,8 @@
end
it "with includes" do
- criteria = Person.all
- criteria.expects(:preload)
- criteria.eager_loadings = [:game]
- criteria.collect(&:game).collect(&:score).should == [10, 20]
+ criteria = Person.includes(:game)
+ criteria.collect(&:game).should == [person1.game, person2.game]
end
end

0 comments on commit 90fa60d

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