ActiveRecord, the Repository Pattern, and You
summary
Claims a way to split domain and persistence on Rails while keeping the framework’s conveniences and getting faster tests, simpler code, decoupling from the DB, and automatic schema migrations. Explores Sequel, ROM, Hanami and dry-rb but implements a prototype called ActiveRecord-Repository gem that composes Active Model for entities and Active Record for repos. Notes surprising scale: ActiveRecord is ~40% of Rails and one model shows 100 instance methods and 600 class methods. Prototype mostly works but hits Active Record relation and persistence edge cases and is not production ready.
AI-written summary · about
chapters (24)
- 0:00Intro
- 3:03Active Record Pattem
- 4:02Active Record - Problems
- 4:43Active Record - Size
- 5:49Active Record - Bifurcation
- 7:21Architecture: The Lost Years
- 8:54Clean Architecture
- 10:14Sequel Dataset
- 10:54Sequel Model
- 14:06ROM Relation - Saving
- 14:38ROM Overview
- 14:51ROM Downsides
- 15:17Hanami Model
- 15:51Hanami Entity
- 16:44Hanami Repository
- 17:06Downsides of the Alternatives
- 17:50Repository Pattern
- 21:23Model with Active Record-Repository
- 22:32Repository with Active Record Repository
- 23:26Controller with Active Record Repository
- 23:56Implementation - Active Model-Entity
- 24:49Implementation - Active Record::Repository
- 25:50Challenges
- 27:33I Need Your Help
related talks
27mRediscovering ActiveRecord
01h 52mBuild High Performance Active Record Apps
39mActiveRecord vs. Ecto: A Tale of Two ORMs
01h 52mBuild High Performance Active Record Apps
33mExperimental Patterns in ActiveRecord
37mPatters to deal with big ActiveRecord models
41mAn Intervention for ActiveRecord
25mActiveRecord can't do it? Arel can!
