Active Record associations seem magical—add a has_many here, a belongs_to there, and suddenly your models are loaded with behavior. Could it be magic, or is it plain old Ruby with some thoughtful design and a bit of metaprogramming? In this talk we'll study Active Record associations by writing our own belongs_to and has_many macros. We'll dynamically define methods, cache query results, replace a a Relation with a CollectionProxy, and automatically prevent N+1 queries with inverses. You'll leave with a deeper understanding of associations, and a new appreciation for their magic. Slides for RailsConf 2022 Talk
Check out these episodes if you want to hear me talk about Ruby, factory_bot, music, and more!
Daniel Colson, from thoughtbot and maintainer of Factory Bot, joins Dave Kimura, Luke Sutters, Tom Rossi, and John Epperson and discuss the transition from a Music career to a development career. We also dive into Factory Bot and its use cases.
On this week's episode, Chris is joined by Daniel Colson, developer in our New York studio and current maintainer of all things FactoryBot. Chris & Daniel discuss Daniel's work as maintainer of one of thoughtbot's most popular open source projects and some of the parallels to thoughtbot's consulting work. They then discuss a bit more on the specifics of FactoryBot and what's in store for upcoming versions.