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 5cdd0bc commit 8d07f061985792a8f15a49e5eb471bf7bb0ed097
@@ -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 8d07f06

Please sign in to comment.