diff options
author | Ernie Miller <ernie@metautonomo.us> | 2011-02-12 13:59:53 -0500 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-02-12 19:52:12 -0200 |
commit | d72add9c20778e253f90fbfe587eae0e205c40ad (patch) | |
tree | 8f182a77fc6b83bd3cadafc150165ad3615c215a /activerecord/test | |
parent | e2b99eb1a77b1b2d8c1ede5239a2f72ef0898cd0 (diff) | |
download | rails-d72add9c20778e253f90fbfe587eae0e205c40ad.tar.gz rails-d72add9c20778e253f90fbfe587eae0e205c40ad.tar.bz2 rails-d72add9c20778e253f90fbfe587eae0e205c40ad.zip |
Fix table name collision due to incorrect alias count on certain joins.
[#6423 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/inner_join_association_test.rb | 7 |
1 files changed, 7 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 da2a81e98a..8f32902c19 100644 --- a/activerecord/test/cases/associations/inner_join_association_test.rb +++ b/activerecord/test/cases/associations/inner_join_association_test.rb @@ -16,6 +16,13 @@ class InnerJoinAssociationTest < ActiveRecord::TestCase assert_equal authors(:david), result.first end + def test_construct_finder_sql_does_not_table_name_collide_on_duplicate_associations + assert_nothing_raised do + sql = Person.joins(:agents => {:agents => :agents}).joins(:agents => {:agents => {:primary_contact => :agents}}).to_sql + assert_match(/agents_people_4/i, sql) + end + end + def test_construct_finder_sql_ignores_empty_joins_hash sql = Author.joins({}).to_sql assert_no_match(/JOIN/i, sql) |