Hansel is tiny library that tracks change to followed models, has support for both syncronous tracking and asynchronous via the different ActiveJob backends that you can plug into your Rails application. Currently only supports for PostgreSQL databases.
Import the concern in the models that you wish to track
class Human < ApplicationRecord
include Hansel::Recordable
end
And after every change to an Human
record you can access its states through the has_many :records
relationship - e.g. Human.first.records # []
Add this line to your application's Gemfile:
gem 'hansel'
And then execute:
$ bundle install
Generate schema migration:
$ rails generate hansel:install
Migrate your database:
$ rails db:migrate
The gem is available as open source under the terms of the MIT License.