Rails Admin history rollback

28th July, 2015

I regularly use rails_admin as my go-to content management system when building Ruby on Rails applications.

Out of the box, rails_admin is compatible with paper_trail, a gem for auditing or versioning model changes. However, it wasn't possible to revert changes easily. I thought it was about time to add this missing feature...

Introducing an extension for RailsAdmin to enable administrators to easily visualise and revert their history audit tracked by the PaperTrail gem.

Google's diff_match_patch library is used to quickly show changes between model versions. See screenshots below.

https://github.com/rikkipitt/rails_admin_history_rollback

https://rubygems.org/gems/rails_admin_history_rollback

Installation

To enable rails_admin_history_rollback, add the following to your Gemfile ensuring it is added after rails_admin:

gem 'rails_admin'
gem 'rails_admin_history_rollback'

It should go without saying that this plugin also requires the paper_trail gem.

E.g. gem 'paper_trail'

Usage

Simply enable paper_trail on your model --with-changes and set up as usual by following the paper_trail instructions.

$ rails generate paper_trail:install --with-changes

Screenshots

History view

Modal view

Contributing

I encourage you to fork and contribute if you fix a bug or create a new feature. Submit a pull request and I'll review it as soon as possible!