Skip to content

Instantly share code, notes, and snippets.

@leompeters
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leompeters/10afbd987bd712cd14db to your computer and use it in GitHub Desktop.
Save leompeters/10afbd987bd712cd14db to your computer and use it in GitHub Desktop.
List widget versions provided by Paper Trail.
<!--
-- Licensed under the MIT license [http://www.opensource.org/licenses/mit-license.php]
-- Copyright (c) 2013 by Belanton, Inc. All Rights Reserved.
-->
<html>
<head>
<title>Belanton | Codes | Scripts | Paper Trail Versions</title>
<meta name="description" content="https://gist.github.com/leonardomarques/10afbd987bd712cd14db">
<meta name="keywords" content="Belanton,team,web,development,Ruby,Rails,ERB,HTML,paper,trail,versions">
<meta name="author" content="Leonardo Marques - Belanton Team [http://www.belanton.com]">
</head>
<body>
<ul>
<% @versions.each do |version| %>
<li>
<%= l version.created_at, format: "%-d.%m.%Y %H:%M:%S %Z" %><br/>
Event ID: <%= version.id %><br/>
<b>Target:</b> <%= version.item_type %>
<small>(id: <%= version.item_id %>)</small>; <b>action</b> <%= version.event %>;<br/>
<div>
More info:
<pre><%= version.object %></pre>
</div>
<div>
Changeset:
<pre><%= version.changeset %></pre>
</div>
<b>User:</b>
<% if version.whodunnit && version.whodunnit != 'Guest' %>
<% user = Profiles::User.find_by_id(version.whodunnit) %>
<% if user %>
<%= user.email_address %>
<% end %>
<% else %>
Guest
<% end %>
<b>Remote address:</b> <%= version.ip %><br/>
</li>
<% end %>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment