Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Coerce strings in create_join_table. #7716
Yep! My backtrace:
I bet it comes from activerecord/lib/active_record/migration.rb:488.
which has arguments of
The first one works, and it's a symbol. The second hits the rescue, which is turned into a string.
@steveklabnik that fails for me without the change:
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
1) Error: test_create_join_table_with_symbol_and_string(ActiveRecord::Migration::CreateJoinTableTest): ArgumentError: comparison of Symbol with String failed
Inverting the string/symbol arguments order also fails. I think it should be enough, wdyt?
added a commit
this pull request
Nov 21, 2012
I'm wondering why this test method works because I've got errors with Ruby 1.9.3-p327 and sqlite3, mysql, mysql2 and postgresql adapters.
1) Error: test_create_join_table_with_symbol_and_string(CopyMigrationsTest): NameError: undefined local variable or method `connection' for #<CopyMigrationsTest:0x00000003df56a8> test/cases/migration_test.rb:760:in `test_create_join_table_with_symbol_and_string'