11155
(-- --)
1
Following this tutorial:
Under; 7.1 Generating a Model
It mentions the following for creating a "Comment" model:
$ rails generate model Comment commenter:string body:text
post:references
In post:references
What is "references"? Is it a data type? And, what does it represent?
Thanks.
11155
(-- --)
2
I saw down few lines in the tutorial the following:
The t.references line sets up a foreign key column for the association
between the two models. Go ahead and run the migration:
So, is "references" simply a "Foreign key"?
Thanks.
So did you go ahead and run it? What did it generate in the db for this field?
Colin
There you are then, presumably in the example Comment belongs_to Post,
so this is generating the foreign key field for the post. Question
answered.
Colin
What do you mean, "what do you mean by run it?"? I don't see any
reference to running anything in my post.
Colin