diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-23 22:20:58 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-23 22:20:58 +0900 |
commit | 40cadf52db5e21349f6ecd9c4dc9b89d42ebc986 (patch) | |
tree | 23862c33c8c4a6cc40ba1f115f8c9e123ff7eb1e /activerecord/test/cases/associations/inner_join_association_test.rb | |
parent | 9fedd013475456dc9bdbf0be45a194cc5fc2566e (diff) | |
download | rails-40cadf52db5e21349f6ecd9c4dc9b89d42ebc986.tar.gz rails-40cadf52db5e21349f6ecd9c4dc9b89d42ebc986.tar.bz2 rails-40cadf52db5e21349f6ecd9c4dc9b89d42ebc986.zip |
Fix duplicate aliases when using both INNER/LEFT JOINs
It should be shared the count of alias tracking in both INNER/LEFT JOINs
to avoid duplicate aliases.
Fixes #30504.
Closes #30410.
Diffstat (limited to 'activerecord/test/cases/associations/inner_join_association_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/inner_join_association_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb index d2494cabfa..eb85acf37e 100644 --- a/activerecord/test/cases/associations/inner_join_association_test.rb +++ b/activerecord/test/cases/associations/inner_join_association_test.rb @@ -27,6 +27,11 @@ class InnerJoinAssociationTest < ActiveRecord::TestCase end end + def test_construct_finder_sql_does_not_table_name_collide_on_duplicate_associations_with_left_outer_joins + sql = Person.joins(agents: :agents).left_outer_joins(agents: :agents).to_sql + assert_match(/agents_people_4/i, sql) + end + def test_construct_finder_sql_does_not_table_name_collide_with_string_joins sql = Person.joins(:agents).joins("JOIN people agents_people ON agents_people.primary_contact_id = people.id").to_sql assert_match(/agents_people_2/i, sql) |