diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-21 11:35:49 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-21 11:35:49 -0800 |
commit | b6793ba110c990ca00bab39a047287bd0bd825f1 (patch) | |
tree | 22496858feced9bc0ce494755243ed6f0b585f9f /activerecord | |
parent | 0cf3092e60d4429467f7e175f610f67e58980f82 (diff) | |
parent | 48a035712e9a4478ff248fd51ff43505d2aa2ddb (diff) | |
download | rails-b6793ba110c990ca00bab39a047287bd0bd825f1.tar.gz rails-b6793ba110c990ca00bab39a047287bd0bd825f1.tar.bz2 rails-b6793ba110c990ca00bab39a047287bd0bd825f1.zip |
Merge pull request #7716 from steveklabnik/issue_7715
Coerce strings in create_join_table.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/migration/join_table.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/migration/join_table.rb b/activerecord/lib/active_record/migration/join_table.rb index e880ae97bb..ebf64cbcdc 100644 --- a/activerecord/lib/active_record/migration/join_table.rb +++ b/activerecord/lib/active_record/migration/join_table.rb @@ -8,7 +8,7 @@ module ActiveRecord end def join_table_name(table_1, table_2) - [table_1, table_2].sort.join("_").to_sym + [table_1.to_s, table_2.to_s].sort.join("_").to_sym end end end diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index c155f29973..b77da39e29 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -755,4 +755,11 @@ class CopyMigrationsTest < ActiveRecord::TestCase ensure clear end + + def test_create_join_table_with_symbol_and_string + connection.create_join_table :artists, 'musics' + + assert_equal %w(artist_id music_id), connection.columns(:artists_musics).map(&:name).sort + end + end |