ruby on rails - paper trails objecat_changes to show in readable form -
i using paper trails showing changes on update through object_changes. view code below
<% @users.each |u|%> <% u.versions.each |v| %> <tr id="" data-hook="admin_products_index_rows" class="odd"> <td class=""><%=v.object_changes%></td> </tr>
my output not readbale formate this
--- first_name: - john - desil updated_at: - 2015-06-23 06:56:49.211694000 z - 2015-07-10 12:03:44.224713593 z
i can remove updated_at ---first_name user friendly formate. there way show these changes in user friendly formate?
please try this
results = u.versions.collect(&:changeset)
this return hash key having table attribute , value have hash in first 1 showing previous value , second showing updated one. , can traverse it
Comments
Post a Comment