diff options
author | Bogdan Gusiev <agresso@gmail.com> | 2019-06-06 14:56:25 +0300 |
---|---|---|
committer | Bogdan Gusiev <agresso@gmail.com> | 2019-06-06 15:14:40 +0300 |
commit | 30c1999df1f50df3faa663efb90e641ff0c2d425 (patch) | |
tree | a67b3cba9b1466b27f59a9b6bc2497008c8ade45 /activerecord/test | |
parent | 30b03ad73bad126538f4c6199522ccd007f101d5 (diff) | |
download | rails-30c1999df1f50df3faa663efb90e641ff0c2d425.tar.gz rails-30c1999df1f50df3faa663efb90e641ff0c2d425.tar.bz2 rails-30c1999df1f50df3faa663efb90e641ff0c2d425.zip |
Fix preloading on AR::Relation where records are duplicated by a join
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 545bc77fed..fe7e5dc559 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -2932,6 +2932,11 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal [], reference.ideal_jobs end + def test_has_many_preloading_with_duplicate_records + posts = Post.joins(:comments).preload(:comments).to_a + assert_equal [1, 2], posts.first.comments.map(&:id) + end + private def force_signal37_to_load_all_clients_of_firm |