Skip to content
Browse files

clean up pk delclaration in `create_table`

  • Loading branch information...
1 parent aac00ed commit 5e0e4152b69a3de1b7e8c063368bf8d06d162834 @tenderlove tenderlove committed
View
9 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -172,7 +172,14 @@ def column_exists?(table_name, column_name, type = nil, options = {})
# See also TableDefinition#column for details on how to create columns.
def create_table(table_name, options = {})
td = create_table_definition
- td.primary_key(options[:primary_key] || Base.get_primary_key(table_name.to_s.singularize)) unless options[:id] == false
+
+ unless options[:id] == false
+ pk = options.fetch(:primary_key) {
+ Base.get_primary_key table_name.to_s.singularize
+ }
+
+ td.primary_key pk
+ end
yield td if block_given?

0 comments on commit 5e0e415

Please sign in to comment.
Something went wrong with that request. Please try again.