aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-02-14 09:28:55 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-02-14 09:28:55 -0800
commitcdbd64d1a3afd5a08c393403da61d8c7c1ae6c72 (patch)
treeded3db6d7a1a844440d3112b4bbc1fb5af530e44 /activerecord/test
parenta254e4b4928735da3bf62a885f8a2ff8915d8a3e (diff)
parent4a4ff504590adfb516502ea332ad0608652b3519 (diff)
downloadrails-cdbd64d1a3afd5a08c393403da61d8c7c1ae6c72.tar.gz
rails-cdbd64d1a3afd5a08c393403da61d8c7c1ae6c72.tar.bz2
rails-cdbd64d1a3afd5a08c393403da61d8c7c1ae6c72.zip
Merge pull request #9252 from senny/8423_hmt_preloading_bug
don't cache invalid subsets when preloading hmt associations
Diffstat (limited to 'activerecord/test')
-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 be2d30641e..3bf9125013 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -1162,4 +1162,10 @@ class EagerAssociationTest < ActiveRecord::TestCase
Post.where('1 = 0').scoping { Comment.preload(:post).find(1).post }
)
end
+
+ test "preloading does not cache has many association subset when preloaded with a through association" do
+ author = Author.includes(:comments_with_order_and_conditions, :posts).first
+ assert_no_queries { assert_equal 2, author.comments_with_order_and_conditions.size }
+ assert_no_queries { assert_equal 5, author.posts.size, "should not cache a subset of the association" }
+ end
end