Topic: Viewable Audit Trail (acts_as_audited)
I'm new to rails/ruby and I have an application built to keep track of various items. I'm trying to find a suitable plugin that would allow me to display and audit trail for these items as various attributes are modified in the db.
I've looked at the various versioning modules and I think acts_as_audited is proably the most suitable for my usage however the only issue is the format in which the changes are kept in (YAML formatted text)
I've got this module working enough to display the various columns such as modified_by, action type, and currently just displaying a column with the raw YAML text in it.
Unfortunately I will at some point need to add some level of filtering to this page and currently the YAML text is DB level and doesn't mean much to the user.
1) Is there a more suitable plugin for audit display?
2) If does anyone recommend the best way to display the YAML formatted text so I can possibly parse out db id #'s and evaluate (i.e. displaying user id # insead of username)
I've copied some sample code from my view below:
<%= @record.tag -%></h1>
<% if @record.audits.empty? -%>
There is no history for this record.</p>
<% else -%>
<% @record.audits.each do |audit| %>
<% user = User.find_by_id(audit.user_id) %>
<td><%=h audit.action.capitalize %></td>
<td><%=h user.username %></td>
<td><%=h audit.changes %></td>
<td><%=h audit.created_at %></td>
<% end %>
<% end -%>
*Note* The above audit.changes is where the yaml formatted string is located and it contains data like the following which notes the values of the activerecord changes, but what I need to show to the user is the actual value changes. Any thoughts there?
- 2010-02-22 10:52:25.187000 -05:00