Skip to content

Commit b6793ba

Browse files
committed
Merge pull request rails#7716 from steveklabnik/issue_7715
Coerce strings in create_join_table.
2 parents 0cf3092 + 48a0357 commit b6793ba

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

activerecord/lib/active_record/migration/join_table.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def find_join_table_name(table_1, table_2, options = {})
88
end
99

1010
def join_table_name(table_1, table_2)
11-
[table_1, table_2].sort.join("_").to_sym
11+
[table_1.to_s, table_2.to_s].sort.join("_").to_sym
1212
end
1313
end
1414
end

activerecord/test/cases/migration_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,4 +755,11 @@ def test_copying_migrations_to_empty_directory
755755
ensure
756756
clear
757757
end
758+
759+
def test_create_join_table_with_symbol_and_string
760+
connection.create_join_table :artists, 'musics'
761+
762+
assert_equal %w(artist_id music_id), connection.columns(:artists_musics).map(&:name).sort
763+
end
764+
758765
end

0 commit comments

Comments
 (0)