mirror of https://github.com/rails/rails
Merge pull request #7716 from steveklabnik/issue_7715
Coerce strings in create_join_table.
This commit is contained in:
commit
b6793ba110
|
@ -8,7 +8,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def join_table_name(table_1, table_2)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -755,4 +755,11 @@ class CopyMigrationsTest < ActiveRecord::TestCase
|
||||||
ensure
|
ensure
|
||||||
clear
|
clear
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue