Nice write up. We did something very similar as well for a project. Never even heard of Papertrail but I guess it is too late anyhow!! LOL
One of the requirements of the projects I’m working on is to keep an audit trail of who’s doing what with the managed data.
Now, you’d expect there to a be a whole stack of gems to cover this and indeed there are, but none of the quite fitted the bill for me: Papertrail (and others) while very very comprehensive are overkill for my needs (I don’t need model versioning) and audited doesn’t support Rails 4.
So I thought I’d have a bash at my own approach, but based on the table structure in Papertrail, and do it manually without the Rails helpers for models and controllers.
1. Create the table (okay, so I like the migration command)
$ rails g migration create_activity_logs item_type:string item_id:integer act_action:string updated_by:string activity:text act_tstamp:datetime
2. Edit the model to look like,
class CreateActivityLogs < ActiveRecord::Migration def change create_table :activity_logs, :options => 'ENGINE=InnoDB DEFAULT…
View original post 550 more words