Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add includes method to finders.rb

  • Loading branch information...
commit 90fa60db500795840bfbdaeb0fc706f6246711d9 1 parent 9d9b272
@flyerhzm authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.