Honesty is a Rails plugin that allows developers to store and track user activities and system events in a human-readable, easily-searchable format.
Add Honesty to your Gemfile:
gem 'honesty'
Rails 3:
rails g honesty
Rails 2:
script/generate honesty
Migrate:
rake db:migrate
class Shoe < ActiveRecord::Base honesty end
Parameters:
-
Context - the object being acted on or the entity being tracked.
-
Agent - the actor, so to speak.
-
Action - the action taking place.
If you want to explicitly denote the context, pass all three parameters
shoe = Shoe.create shoe.fact("Shoe", "Tim Boisvert", "Created Adidas Superstar II")
If you want to short-cut the fact and use the object’s class name as the context, just pass in the agent and the action
shoe = Shoe.create shoe.fact("Tim Boisvert", "Created Adidas Superstar II")
shoe = Shoe.find(1) facts = shoe.facts.all
This plugin is heavily influenced by acts_as_commentable. Thanks to Jack Dempsey et al.
Tim Boisvert