-
Notifications
You must be signed in to change notification settings - Fork 67
Home
Kalman Hazins edited this page Mar 23, 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 "belongs_to".
But the previous Person
class in person.rb
was not updated with the "has_one" as was 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: