The document summarizes key topics from a Ruby on Rails lab on active record associations. It discusses how to add and delete orders, use primary and foreign keys to connect models, and the different types of associations like has_one, has_many, belongs_to, and has_and_belongs_to_many. It also covers association options, polymorphic associations, self joins, counter caches, and the :touch option.
18. belongs_to vs
has_one
• “belongs_to” model has a foreign key
• dependent upon the actual meaning of data
ROR Lab.
19. has_many :through vs
has_and_belongs_to_many
๏ has_many
- validations, callbacks, or extra attributes
๏ has_and_belongs_to_many
- no need for additional functionalities
- should create a “join” table in the DB.
ROR Lab.