Method: ActiveRecord::ConnectionAdapters::Table#foreign_key
- Defined in:
- activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
#foreign_key(*args, **options) ⇒ Object
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")
895 896 897 898 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 895 def foreign_key(*args, **) () @base.add_foreign_key(name, *args, **) end |