ActiveRecord vs. Ecto: A Tale of Two ORMs
summary
Compares a Rails ActiveRecord implementation of a Hallway Track app to an Elixir Phoenix/Ecto rewrite and shows concrete tradeoffs: ActiveRecord reads like English but produces preload causing N+1 and encourages seeing stars select problem*, spreading SQL across scopes; Ecto uses explicit Repo/schema/changeset/query, prevents N+1 by design, forces eager queries, uses Multi for transactional writes, runs tests concurrently on the Erlang VM, and yields fewer runtime surprises at the cost of more boilerplate.
AI-written summary · about
chapters (50)
- 0:00Introduction
- 0:48What is Erlang
- 2:59What is Ecto
- 5:33Brads ORM journey
- 5:59Functional programming
- 7:07ActiveRecord
- 7:33Hallway Track
- 8:24ActiveRecord Setup
- 8:59ActiveRecord Controller
- 10:13ActiveRecord Preload
- 10:47leaky abstraction
- 11:46objectoriented programming
- 12:19query join
- 12:51seeing stars
- 13:41summary
- 15:25transaction management
- 16:12Rails ActiveRecord
- 16:48Word of the Day
- 17:02Phoenix
- 17:22Ecto Model
- 18:08Ecto Controller
- 18:59Repository Pattern
- 19:59No Save Method
- 20:34Struts
- 20:51Query
- 21:40Sequel
- 23:09Phoenix Council
- 24:36Change Sets
- 24:58Pipeline Operator
- 25:29Update Operator
- 26:25Multi
- 27:41Explicit
- 28:15Responsibility segregation
- 30:00Sequel syntax
- 30:59Sequel downside
- 31:53Sequel robot talk
- 32:15Explicitness
- 32:55Constraints
- 34:01Testing
- 35:10Ecto Adapters
- 35:33Tradeoffs
- 35:59Sequel ORM
- 36:15Trail Blazers ORM
- 36:27ActiveRecord ORM
- 36:44Resources
- 37:13Phoenix talk
- 37:23Who am I
- 37:40Where I work
- 38:06How we track
- 38:25Callbacks
related talks
29mActiveRecord, the Repository Pattern, and You
32mRails to Phoenix: How Elixir can level-you-up in Rails
33mExperimental Patterns in ActiveRecord
25mActiveRecord can't do it? Arel can!
01h 52mBuild High Performance Active Record Apps
01h 52mBuild High Performance Active Record Apps
41mAn Intervention for ActiveRecord
38mSequel: When ActiveRecord is not enough
