has_one, has_many and belongs_to in ActiveRecord

The table with the foreign key in it belongs_to the table that that foreign key references.

The table with the referenced primary key in it has_one or has_many of the table with the foreign key in it.

I will not forget this again!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.