diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-26 23:48:43 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-26 23:49:04 -0300 |
commit | a335e10347e30b885d077cd9e638ee8840ed164a (patch) | |
tree | c67029c77ac1e71b03eb1b9c0801fecc04ea9818 /activerecord | |
parent | 5462ffa08e84000e66f9f4b9ce5f47a7f62dc640 (diff) | |
download | rails-a335e10347e30b885d077cd9e638ee8840ed164a.tar.gz rails-a335e10347e30b885d077cd9e638ee8840ed164a.tar.bz2 rails-a335e10347e30b885d077cd9e638ee8840ed164a.zip |
Add test case for b13d260
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index ebcf453305..8d7670aeb3 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -1196,6 +1196,15 @@ class EagerAssociationTest < ActiveRecord::TestCase end end + test "preloading the same association twice works" do + Member.create! + members = Member.preload(:current_membership).includes(current_membership: :club).all.to_a + assert_no_queries { + members_with_membership = members.select(&:current_membership) + assert_equal 3, members_with_membership.map(&:current_membership).map(&:club).size + } + end + test "preloading with a polymorphic association and using the existential predicate" do assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer |