git404hub

what is paper_trail fr?

paper-trail-gem/paper_trail — explained in plain English

Analysis updated 2026-06-24

7,000RubyAudience · developerComplexity · 2/5Setup · easy

tl;dr

Ruby gem for Rails apps that automatically records every create, update, and delete on your database records, giving you a full change history you can browse, diff, or roll back at any time.

vibe map

mindmap
  root((paper_trail))
    What it does
      Records all changes
      Full version history
      Restore past states
    Setup
      Add gem to project
      Run migration
      Add to model
    Features
      Who changed it
      When it changed
      Field-level control
    Testing
      RSpec helpers
      Minitest helpers
      Cucumber support

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Add an audit trail to a Rails app to track who changed what record and when

VIBE 2

Let users undo accidental edits by restoring a record to any previous version

VIBE 3

Meet compliance requirements by keeping a tamper-evident log of all data changes

what's the stack?

RubyRails

how it stacks up fr

paper-trail-gem/paper_trailskwp/dotfilesmiddleman/middleman
Stars7,0006,9737,110
LanguageRubyRubyRuby
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 30min

in plain english

PaperTrail is a Ruby gem for Rails applications that records every change made to your database records. When someone creates, updates, or deletes a record, PaperTrail saves a snapshot of what the record looked like before the change. You can then look back at the full history of any record, see exactly what changed and when, and restore a previous state if needed. This is useful for audit logs, undoing mistakes, or simply understanding how data changed over time. Setup involves three steps: adding the gem to your project, running a generator that creates a new database table called versions to store the history, and adding a single line to any model you want to track. After that, every tracked record gains a versions method that returns its full change history. Each saved version tells you what event occurred (create, update, or destroy), when it happened, and optionally who triggered it. If your app has a logged-in user concept, a one-line addition to your base controller wires up automatic tracking of who made each change. To restore a record to a past state, you call reify on a version object, which reconstructs the record as it existed at that point in time. You have fine-grained control over what gets tracked. You can choose to record only certain lifecycle events, skip tracking when specific conditions are met, include or exclude individual fields, or turn tracking off entirely for a block of code. There are also options to limit how many versions are kept, attach extra metadata to each version, and track changes to associated records. PaperTrail is one of the longest-standing gems in the Rails ecosystem, with a version history stretching back to Rails 2.3. It follows semantic versioning and ships with test helpers for Minitest, RSpec, and Cucumber. The full README is longer than what was shown.

prompts (copy fr)

prompt 1
Show me how to add PaperTrail to a Rails model so every update is recorded, and how to display the change history in a view
prompt 2
Using PaperTrail, write a Rails controller action that lets a user restore a record to its state from one week ago
prompt 3
How do I configure PaperTrail to track which logged-in user made each change and store that in the versions table?
prompt 4
I want to exclude a sensitive field like password_digest from PaperTrail tracking, show me how to set that up

Frequently asked questions

what is paper_trail fr?

Ruby gem for Rails apps that automatically records every create, update, and delete on your database records, giving you a full change history you can browse, diff, or roll back at any time.

What language is paper_trail written in?

Mainly Ruby. The stack also includes Ruby, Rails.

How hard is paper_trail to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is paper_trail for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.