Skip to content

Commit

Permalink
add_foreign_key takes keyword arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
amatsuda committed Sep 24, 2019
1 parent d1d1a2d commit deef6a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,8 @@ def remove_references(*args, **options)
# t.foreign_key(:authors, column: :author_id, primary_key: "id")
#
# See {connection.add_foreign_key}[rdoc-ref:SchemaStatements#add_foreign_key]
def foreign_key(*args)
@base.add_foreign_key(name, *args)
def foreign_key(*args, **options)
@base.add_foreign_key(name, *args, **options)
end

# Removes the given foreign key from the table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ def foreign_keys(table_name)
# Action that happens <tt>ON UPDATE</tt>. Valid values are +:nullify+, +:cascade+ and +:restrict+
# [<tt>:validate</tt>]
# (PostgreSQL only) Specify whether or not the constraint should be validated. Defaults to +true+.
def add_foreign_key(from_table, to_table, options = {})
def add_foreign_key(from_table, to_table, **options)
return unless supports_foreign_keys?

options = foreign_key_options(from_table, to_table, options)
Expand Down

0 comments on commit deef6a3

Please sign in to comment.