An Administrate plugin to show record change histories from PaperTrail
MIT License
An Administrate plugin to show record change histories from PaperTrail.
Make sure you already setup PaperTrail properly in your project.
Add administrate-field-paper_trail
to your Gemfile:
gem 'administrate-field-paper_trail'
And then execute:
$ bundle install
Add to your UserDashboard
:
ATTRIBUTE_TYPES = {
changeset: Field::PaperTrail.with_options(excluded_attributes: %w[created_at updated_at]),
}
The excluded_attributes
option takes an array of string of the attributes you want to exclude from the result. Default excluded attributes are: id
, created_at
, and updated_at
.
Then show the field in your show page like so:
SHOW_PAGE_ATTRIBUTES = %i[
changeset
]
Currently, only support to show changes in the show page. Contribution will be appreciated.
bundle exec rspec
Based on the Administrate::Field::Image template