diff options
author | Greg Molnar <molnargerg@gmail.com> | 2016-03-17 11:54:02 +0100 |
---|---|---|
committer | Greg Molnar <molnargerg@gmail.com> | 2016-03-17 11:54:02 +0100 |
commit | 62c01d3c1f9a117d6869cb006e1cfe1ed456df04 (patch) | |
tree | 091cf4bb3dee12c854810902139c4db6d0ef44a1 /activerecord/lib/active_record | |
parent | f5a5988352b165143f0f9d622707c351c1470882 (diff) | |
download | rails-62c01d3c1f9a117d6869cb006e1cfe1ed456df04.tar.gz rails-62c01d3c1f9a117d6869cb006e1cfe1ed456df04.tar.bz2 rails-62c01d3c1f9a117d6869cb006e1cfe1ed456df04.zip |
add column type option to create_join_table to support uuid
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 5 |
1 files changed, 3 insertions, 2 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 a401310ee0..df7f91639c 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -329,12 +329,13 @@ module ActiveRecord column_options = options.delete(:column_options) || {} column_options.reverse_merge!(null: false) + type = column_options.delete(:type) || :integer 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| - td.integer t1_column, column_options - td.integer t2_column, column_options + td.send type, t1_column, column_options + td.send type, t2_column, column_options yield td if block_given? end end |