Skip to content

Commit fd495a8

Browse files
committed
updates a migration example in the Getting Started guide [ci skip]
Closes rails#20705.
1 parent 6a6c4c4 commit fd495a8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

guides/source/getting_started.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff 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
15561554
end
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

0 commit comments

Comments
 (0)