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...
nertzy committed May 11, 2013
1 parent 943596c commit 4e09301b0ce6f24bbc3980725d87774792867d01
@@ -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))
# Returns a ColumnDefinition for the column with name +name+.

0 comments on commit 4e09301

Please sign in to comment.