Refactoring Rails
summary
Implements nested through associations in Rails 3 by turning association reflections into linear chains (recursing to leaf reflections) and generating identical SQL joins for different association shapes; splits the collection proxy from the association (avoiding method_missing recursion), replaces a tangled preload module with an object hierarchy using polymorphism and single-responsibility, fixes many Lighthouse-reported bugs and adds tests. Patch complexity drops from +342 lines to +94 lines and the feature merges after ~6 months.
AI-written summary · about
chapters (8)
- 0:00Start
- 3:17Project
- 7:20Use good data structures
- 13:19Association Proxy
- 19:07Object Oriented Programming!
- 21:21Many or repeated
- 22:34Long methods lots of variables
- 25:12Learn from the mistakes of others.
related talks
32mReflecting on Active Record Associations
39mDown The Rabbit Hole: An Adventure in Legacy Code
31mIf it bleeds, it leads
38mOur Fight Against Super Bad Patterns in Legacy Rails Apps
01h 09mRails 3 ...and the real secret to high productivity
19mAn ActiveRecord Rewrite: the Story Behind the Attributes API
01h 09mAll the Things I Thought I Couldn't Do
53mRuby 2 in Ruby on Rails
