method

foreign_key

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Table
foreign_key(*args, **options) public

Adds a foreign key to the table using a supplied table name.

t.foreign_key(:authors)
t.foreign_key(:authors, column: :author_id, primary_key: "id")

See {connection.add_foreign_key}[rdoc-ref:SchemaStatements#add_foreign_key]

Show source
Register or log in to add new notes.