aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations/eager_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/associations/eager_test.rb')
-rw-r--r--activerecord/test/associations/eager_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/associations/eager_test.rb b/activerecord/test/associations/eager_test.rb
index d48821ce0a..114da92542 100644
--- a/activerecord/test/associations/eager_test.rb
+++ b/activerecord/test/associations/eager_test.rb
@@ -271,6 +271,13 @@ class EagerAssociationTest < Test::Unit::TestCase
assert_not_nil f.account
assert_equal companies(:first_firm, :reload).account, f.account
end
+
+ def test_eager_with_multi_table_conditional_properly_counts_the_records_when_using_size
+ author = authors(:david)
+ posts_with_no_comments = author.posts.select { |post| post.comments.blank? }
+ assert_equal posts_with_no_comments.size, author.posts_with_no_comments.size
+ assert_equal posts_with_no_comments, author.posts_with_no_comments
+ end
def test_eager_with_invalid_association_reference
assert_raises(ActiveRecord::ConfigurationError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") {