# PaperTrail

> Track changes to your models, for auditing or versioning

Source: https://talira.ai/catalog/papertrail-7kexeja9
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / databases / audit trails](https://talira.ai/categories/libraries/databases/audit-trails), [languages / ruby / rails](https://talira.ai/categories/languages/ruby/rails), [compliance / audit logging](https://talira.ai/categories/compliance/audit-logging)
- Licence: MIT[^2]
- Pricing: Free and open source[^2]
- Free tier: yes[^2]
- Self-hostable: yes[^1]
- API: yes[^1]
- Plugins: yes[^1]
- Creator: Andy Stewart

PaperTrail records each create, update, destroy and touch of an Active Record model as a row in a `versions` table, so you can see how a record looked at any point, revert it to an earlier version, or bring it back after it was destroyed. Each version stores the record as it was before the change, optionally the `object_changes` diff, `whodunnit` (usually the current user, set by a controller callback) and any metadata you add. You choose which events and attributes to track, can skip sensitive columns, cap versions per record, query versions by their stored values (best with [PostgreSQL](https://talira.ai/catalog/postgresql-cm55wcnd.md) `json` or `jsonb` columns), and plug in your own version classes and serializers. Andy Stewart created it in 2009; association tracking now lives in the separate paper_trail-association_tracking gem.

## Links

- GitHub: https://github.com/paper-trail-gem/paper_trail
- Docs: https://www.rubydoc.info/gems/paper_trail

## Problems it solves

- undo an accidental edit in my Rails app by restoring the record's previous version
- bring back a record someone deleted, with all its old attribute values
- see what a model looked like on a specific date
- record which user made each change to our Rails models for an audit
- store extra context like the IP address or request ID with each change to a record
- show a field-by-field list of what changed in each edit
- track changes to only some columns and never keep sensitive fields in the history
- our version history table keeps growing; keep only the last few versions per record
- find every past version of a record where a column had a particular value
- start versioning models that already have data and still get their original values back
- keep version history for different models in separate tables
- turn change tracking off during a bulk import or in tests

## Features

- versions for create, update, destroy and touch
- reify, revert and undelete records
- version_at, previous_version and next_version navigation
- whodunnit from the controller's current_user
- metadata per version from the model (meta) or the controller (info_for_paper_trail)
- object_changes for a changeset of each version
- on, only, ignore, skip, if and unless options
- version_limit globally or per model
- where_object and where_object_changes queries; json and jsonb columns on PostgreSQL
- custom version classes and tables, custom serializers
- Minitest, RSpec and Cucumber test helpers
- install generator with an initializer

## Limitations

- Doesn't track or restore associations by itself: that's the separate paper_trail-association_tracking gem[^1]
- Doesn't diff non-adjacent versions: you write your own code or use a diff library for that[^1]

## Capabilities

- Has an API: plan not known
- Takes plugins: plan not known

## Trust

Overall: 0.34 out of 1.
Signals: backing 0.20, extensibility 0.40.

- created by Andy Stewart
- has a plugin system

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [Audited](https://talira.ai/catalog/audited-envv38k9.md): Audited (formerly acts_as_audited) is an ORM extension that logs all changes to your Rails models.

## Sources

[^1]: https://github.com/paper-trail-gem/paper_trail (checked 20 Nov 2026)
[^2]: https://github.com/paper-trail-gem/paper_trail/blob/master/LICENSE (checked 20 Nov 2026)
