← Graph

Active Record

concept 14 connections

Rails' default persistence pattern. Panel's critique: callbacks like `after_create` hide whole business processes behind a magic one-liner, so a small class with four after_create hooks is actually a complex process in disguise. Testing any one callback drags in withdrawals, fraud detection, loyalty-program updates and more — one absurd unit of testing. It keeps data in latest state only (no history), and combined with unpartitioned codebases causes enterprise Rails apps to slow to a crawl. Contrast with event sourcing, where state is derived from an append-only event log.

category
pattern
about
Active Record concept
Named as the 'worst thing' that can happen in enterprise Rails when systems aren't partitioned.
about
Active Record concept
Discusses the coupling and 'infinite API' problems of inheriting from ActiveRecord::Base.
about
Active Record concept
Addresses the problem of bloated Active Record models.
about
Active Record concept
Recommends constructor-based defaults instead of callbacks and treating persistence as a detail handled by mutators.
about
Active Record concept
Uses MVC+ORM as the foil against which event sourcing is contrasted.
about
Active Record concept
Critique of callbacks and ORM-hidden coupling revealed by test setup code.
about
Active Record concept
Canonical example of an entangling ORM.
about
Active Record concept
Discusses Active Record's connection pool, transaction wrapping, and multi-database support.
Answer credits Active Record's database abstraction.
about
Active Record concept
Persistence model and transaction semantics (after-commit, rollback) are core to the verification flow.
related_to
Active Record concept
Proposed specifically as a way to shrink bloated Active Record models.
concept Mutator Layer
related_to
Active Record concept
Mutators encapsulate Active Record creation/edit/delete so services don't touch persistence directly.
related_to
Active Record concept
Built on Active Record's three-tier multi-database support with a custom resolver and a patched transaction method.
uses
Active Record concept
Patches Active Record's SQLite adapter and backports adapter features from Rails main.

Provenance

Created in
Enterprise Rails Panel (wroclove.rb 2018) 2026-04-17 16:18
Read by
29 extractions