|
|
|
|
|
by nicolasMLV
2794 days ago
|
|
Rails uses foreign keys by default, usually I generate a migration file with `rails generate migration AddThisToThing this:references` Then this line is generated `add_reference :things, :this, foreign_key: true` and then we call the migration, and there is the foreign key. |
|
By default the relationship constructors do not create foreign keys, if they did it would be redundant to include it in the generated output surely? At least that's what the docs seem to say.