diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/migration/join_table.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index a246e6ace1..a80c1cec39 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -204,11 +204,11 @@ module ActiveRecord join_table_name = find_join_table_name(table_1, table_2, options) column_options = options.delete(:column_options) || {} - column_options.reverse_merge!({:null => false}) + column_options.reverse_merge!(null: false) - t1_column, t2_column = [table_1, table_2].map{ |t| "#{t.to_s.singularize}_id" } + t1_column, t2_column = [table_1, table_2].map{ |t| t.to_s.singularize.foreign_key } - create_table(join_table_name, options.merge!(:id => false)) do |td| + create_table(join_table_name, options.merge!(id: false)) do |td| td.integer t1_column, column_options td.integer t2_column, column_options yield td if block_given? diff --git a/activerecord/lib/active_record/migration/join_table.rb b/activerecord/lib/active_record/migration/join_table.rb index e880ae97bb..e456c81fc9 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, table_2].sort.join("_") end end end |