Last active
July 31, 2019 17:55
-
-
Save antarr/f0115be07391b4c0a4de2b0d314eea0f to your computer and use it in GitHub Desktop.
Active Admin Version Panel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/ext/activeadmin.rb | |
module ActiveAdminPaperTrailDetails | |
def versions | |
panel 'Versions', class: 'versions' do | |
table_for resource.versions.order :created_at do | |
column(:whodunnit) { |v| auto_link User.find_by(id: v.whodunnit) } | |
column :event | |
column 'When', :created_at | |
column 'Changes' do |v| | |
attributes_table_for v.changeset.to_a do | |
row(:attribute) { |attr, _| attr } | |
row(:before) { |_, (before, _)| before } | |
row(:after) { |_, (_, after)| after } | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment