File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -1546,8 +1546,6 @@ class CreateComments < ActiveRecord::Migration
15461546 create_table :comments do |t |
15471547 t.string :commenter
15481548 t.text :body
1549-
1550- # this line adds an integer column called `article_id`.
15511549 t.references :article , index: true , foreign_key: true
15521550
15531551 t.timestamps null: false
@@ -1556,9 +1554,9 @@ class CreateComments < ActiveRecord::Migration
15561554end
15571555```
15581556
1559- The ` t.references ` line sets up a foreign key column for the association between
1560- the two models. An index for this association is also created on this column.
1561- Go ahead and run the migration:
1557+ The ` t.references ` line creates an integer column called ` article_id ` , an index
1558+ for it, and a foreign key constraint that points to the ` articles ` table. Go
1559+ ahead and run the migration:
15621560
15631561``` bash
15641562$ bin/rake db:migrate
You can’t perform that action at this time.
0 commit comments