a Ruby gem for tracking changes in your model data
PaperTrail is a Ruby gem for tracking changes in your model data. It does this by recording all create
, update
, and destroy
actions in instances of your models that call has_paper_trail
. Versions of tracked models can be retrieved via their versions
method.
PaperTrail was originally developed by Andy Stewart at AirBlade Software.
Usage Example
class Example < ActiveRecord::Base
has_paper_trail
end
example = Example.new(name: "Ruby")
example.name # "Ruby"
example.update_attribute(:name, "Rails")
example.name # "Rails"
example.versions.last.reify.name # "Ruby"
example.versions.last.event # "update"