Chapter 7. ActiveRecord Associations
Any time you can rarefy something, you can create something that embodies a concept, it gives you leverage to work with it more powerfully. That’s exactly what’s going on with has_many :through.
Active Record associations let you declaratively express relationships between model classes. The power and readability of the Associations API is an important part of what makes working with Rails so special.
This chapter covers the different kinds of ActiveRecord
associations available while highlighting use cases and available customizations for each of them. We also take a look at the classes that give us access to relationships themselves.
The Association Hierarchy
Get The Rails Way now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.