Skip to content
Kalman Hazins edited this page Mar 23, 2016 · 6 revisions

Frequently Asked Questions (FAQs) - Course 2 Module 2


Table of Contents


Q: Person model was not updated with "has_one"

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:

Back To Top


Clone this wiki locally