I made two models - “task” and “comment” in my app without any
connections each other, but now I wanna a “one to many” between them,
saying one task has many comments, one comments has to belong to one
Therefore, I add “belongs_to :task” and “has_many :comments” in each
The question is:
1> I dont think the two tables in the database will add the
foreign_key column inside automatically after I said “belongs_to &
has” in models. Am I right? At least I didnt find it by investigating
2> what should I do if I dont wanna use SQL or DDL to create
foreign_key cloumn, is the “migrate” able to help me?
Thanks a lot!