-
Notifications
You must be signed in to change notification settings - Fork 67
Home
Faacy Farook edited this page Jan 14, 2016
·
6 revisions
Table of Contents
After running:
rails g model personal_info height:float weight:float person:references
rake db:migrate
PersonalInfo
class in personal_info.rb
was created with the "belong_to".
But the previous Person
class in person.rb
was not updated with the "has_one" as it is shown in the video.
Why is that?
A: Actually, in the video the "has_one" wasn't updated either. You have to put that in yourself. The reason is that ActiveRecord doesn't know if you want the other side to be a "has_one" or "has_many", so it leaves it up to you to specify that end of the relationship.
The "belongs_to" will be the same whether it is a "has_one"" or "has_many".
Additional References: