Skip to content
Latchkey

What Is the Active Record Pattern?

In the active record pattern, an object wraps a single database row and exposes methods like save and delete directly on itself. Data and persistence behavior live together in the same class. It is simpler than a data mapper for straightforward applications but blurs the line between domain logic and storage.

Why it matters

Active record is quick to build with and easy to read for simple CRUD, which is why many web frameworks adopt it. As domain complexity grows, mixing persistence into objects can make rules harder to isolate and test.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →