aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/eager_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-02-18 00:14:54 +0000
committerMichael Koziarski <michael@koziarski.com>2008-02-18 00:14:54 +0000
commitf2546164d6eb9302d1ff5d36939d128b8f96feb1 (patch)
treee7f4d7f718686da00e6062d50997e58975c6cf0a /activerecord/test/cases/associations/eager_test.rb
parent23e58a0552b4febd9372ee4642b0da886d92fd7a (diff)
downloadrails-f2546164d6eb9302d1ff5d36939d128b8f96feb1.tar.gz
rails-f2546164d6eb9302d1ff5d36939d128b8f96feb1.tar.bz2
rails-f2546164d6eb9302d1ff5d36939d128b8f96feb1.zip
Make dynamic finders respect the :include on HasManyThrough associations. Closes #10998. [cpytel]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/cases/associations/eager_test.rb')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index a4fd71abea..810336684c 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -246,6 +246,12 @@ class EagerAssociationTest < ActiveRecord::TestCase
author_posts_without_comments = author.posts.select { |post| post.comments.blank? }
assert_equal author_posts_without_comments.size, author.posts.count(:all, :include => :comments, :conditions => 'comments.id is null')
end
+
+ def test_eager_count_performed_on_a_has_many_through_association_with_multi_table_conditional
+ person = people(:michael)
+ person_posts_without_comments = person.posts.select { |post| post.comments.blank? }
+ assert_equal person_posts_without_comments.size, person.posts_with_no_comments.count
+ end
def test_eager_with_has_and_belongs_to_many_and_limit
posts = Post.find(:all, :include => :categories, :order => "posts.id", :limit => 3)