Rails Admin History Rollback
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.
Simply enable paper_trail on your model
--with-changes --with-associations and set up as usual by following the paper_trail instructions.
rails generate paper_trail:install --with-changes --with-associations
rails_admin.rb initializer, uncomment the following lines to enable auditing:
You may also need to
require "paper_trail" in
As pointed out in issue #8,
paper_trail master branch and release v5.0.0 (when available) causes session issues. Login is reset by devise;
paper_trail tries to access to the
current_user variable before
The fix is to manually add
set_paper_trail_whodunnit before_action as advised here: (https://github.com/airblade/paper_trail#finding-out-who-was-responsible-for-a-change)
# app/controllers/application_controller.rb class ApplicationController < ActionController::Base [...] before_action :set_paper_trail_whodunnit [...] end
This repository is maintained and funded by Jemcode Limited. We are available for hire.