Honesty

Honesty allows developers to store and track user activities and system events in a human-readable, easily-searchable format.

Resources

Install

  • gem install honesty

  • If using bundler:

** Add “gem ‘honesty’” to your Gemfile ** “bundle install”

Generate the model:

** Rails 3: rails g honesty ** Rails 2: script/generate honesty

Migrate: ** rake db:migrate

Usage

* use Honesty in your ActiveRecord model.

class Shoe < ActiveRecord::Base
	honesty
end

* Add a fact to a model instance

Parameters:
* Context - the object being acted on or the entity being tracked.
* Agent - the actor, so to speak.
* Action - the action taking place.

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:

shoe = Shoe.create
shoe.fact("Tim Boisvert", "Created Adidas Superstar II")

In this case the context would've been set to the class name of the object calling it -- in this case, Shoe 

* Get facts:

shoe = Shoe.find(1)
facts = shoe.facts.all

Credits

This plugin is heavily influenced by Acts As Taggable. Thanks to Jack Dempsey et al.

Contributors

Tim Boisvert

More

github.com/timboisvert/honesty