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 15:33:30 -0200
commitc5451777b038c5e48567f69256986ae42a2cde48 (patch)
treedbbc7e1735ba0250ded7403d4ac0baf9d8e731d7 /activerecord/test
parentee3e3a90f31af5845849dc631ff301e79c95b28a (diff)
downloadrails-c5451777b038c5e48567f69256986ae42a2cde48.tar.gz
rails-c5451777b038c5e48567f69256986ae42a2cde48.tar.bz2
rails-c5451777b038c5e48567f69256986ae42a2cde48.zip
Merge pull request #9252 from senny/8423_hmt_preloading_bug
don't cache invalid subsets when preloading hmt associations Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/eager_test.rb
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 20c6b691fc..5d07ffa241 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -1112,4 +1112,10 @@ class EagerAssociationTest < ActiveRecord::TestCase
Post.includes(:comments).order(nil).where(:comments => {:body => "Thank you for the welcome"}).first
end
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