Andrew Cetinic
Andrew Cetinic

Reputation: 2835

RailsAdmin papertrail empty history

I have configured RailsAdmin to use papertrail for showing the history of changes on models.

It seems to be working fine, but in the UI it displays changes always as an empty array. Is this the expected output? I was expecting to see the actual changes made on the records, or even better a drill down with a before and after change on the record.

RailsAdmin History Tab

Upvotes: 1

Views: 1457

Answers (2)

earnold
earnold

Reputation: 1462

You need to have a column called object_changesin your versions table.

See these instructions from paper_trail. Look at the section called "Diffing Versions."

In short, when you generate the versions table, do this rails g paper_trail:install --with-changes

Or, if you already have an objects table, do this migration:

class AddObjectChangesColumnToVersions < ActiveRecord::Migration
  def self.up
    add_column :versions, :object_changes, :text
  end

  def self.down
    remove_column :versions, :object_changes
  end
end

Upvotes: 2

Jeremy
Jeremy

Reputation: 611

I'm seeing the exact same thing and filed a bug report with rails_admin: https://github.com/sferik/rails_admin/issues/1751

If that is addressed I'll update this comment.

Upvotes: 0

Related Questions