finds.dev

paper-trail-gem/paper_trail

Track changes to your rails models

View on GitHub

★ 7,022RubyMITupdated May 2026

// the take

PaperTrail is an ActiveRecord audit log gem that stores a snapshot of your model before each change, letting you revert records, page through their history, or restore destroyed ones. It's been around since Rails 2 days and is the de facto standard for this problem in Rails apps. If you need to know who changed what and when, this is what you reach for.

Stores pre-change state rather than post-change, which means you can start tracking existing records without losing the 'before' baseline — a subtle but important design choice. The `whodunnit` + `PaperTrail.request` thread-local scoping is well thought out for web apps: you set it once in a controller callback and it flows through without threading issues. Custom metadata columns let you denormalize audit-relevant data (author_id, IP, etc.) directly onto version rows, which saves you from deserializing every version just to filter them. The serializer abstraction and custom version class support mean you can adapt it to jsonb columns and per-table version tables without forking it.

The `versions` table balloons fast on high-write models — every update to a busy table is a full object snapshot, not a diff. There's a `version_limit` config but it's a blunt instrument and doesn't apply to create events. Association tracking was extracted into a separate gem (paper_trail-association_tracking) and described as having 'many issues'; if you need to reify a record and its associations together, you're on your own. The `item_id` polymorphism problem — deleted parent records can have their IDs reused by new records, corrupting the version linkage — is documented but the only practical solution given is soft-deletes, which is a significant architectural imposition on adopters.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
7,022
Forks
910
Language
Ruby
License
MIT
Last commit
8 May 2026

// nearby

If paper_trail isn't quite it.

All repos →