diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-02-11 21:24:11 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-02-14 17:46:07 +0100 |
commit | 4a4ff504590adfb516502ea332ad0608652b3519 (patch) | |
tree | 55556c392e53ea5662aa2e3c110815525af33881 /activerecord/test/cases/associations | |
parent | 1fd78305b5812c186d9eed9475677f90946eba5f (diff) | |
download | rails-4a4ff504590adfb516502ea332ad0608652b3519.tar.gz rails-4a4ff504590adfb516502ea332ad0608652b3519.tar.bz2 rails-4a4ff504590adfb516502ea332ad0608652b3519.zip |
don't cache invalid subsets when preloading hmt associations.
closes #8423.
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 6 |
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 |