Skip to content
Browse files

Don't modify args in TableDefinition#primary_key

Previously, if you reused a hash that was passed into a table definition,
then subsequent tables' primary keys would be set to "true" instead of "id".
  • Loading branch information...
1 parent 943596c commit 4e09301b0ce6f24bbc3980725d87774792867d01 @nertzy nertzy committed
View
3 activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -65,8 +65,7 @@ def columns; @columns_hash.values; end
# Appends a primary key definition to the table definition.
# Can be called multiple times, but this is probably not a good idea.
def primary_key(name, type = :primary_key, options = {})
- options[:primary_key] = true
- column(name, type, options)
+ column(name, type, options.merge(:primary_key => true))
end
# Returns a ColumnDefinition for the column with name +name+.

0 comments on commit 4e09301

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