Skip to content

Commit

Permalink
Fix for Issue #1306
Browse files Browse the repository at this point in the history
Makes use of PaperTrail's Version's change set to provide more insight into what changed from one version to the next.
  • Loading branch information
jorgeramos committed Sep 24, 2012
1 parent 90efcc3 commit 7275ebd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/rails_admin/main/history.html.haml
Expand Up @@ -34,7 +34,7 @@
%td= object.username
- if @general
%td= object.item
%td= object.message
%td= object.changes

- unless params[:all] || !@history.respond_to?(:current_page)
= paginate(@history, :theme => 'twitter-bootstrap', :remote => true)
Expand Down
7 changes: 6 additions & 1 deletion lib/rails_admin/extensions/paper_trail/auditing_adapter.rb
Expand Up @@ -8,7 +8,12 @@ def initialize(version, user_class = User)
end

def message
"#{@version.event} #{@version.item_type} id #{@version.item_id}"
@message = "#{@version.event} #{@version.item_type} ID #{@version.item_id}"
@version.respond_to?(:changeset) ? @message + " [" + changes + "]" : @message
end

def changes
@version.changeset.to_a.collect {|c| c[0] + " = " + c[1][1].to_s}.join(", ")
end

def created_at
Expand Down

0 comments on commit 7275ebd

Please sign in to comment.