From d3dfbb82981d26fc338e2d59d587359a94e304fe Mon Sep 17 00:00:00 2001 From: Guillaume DOTT Date: Wed, 29 May 2013 10:10:55 +0200 Subject: [PATCH] Write README.md --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 924ab1f..195c4d3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # RailsBigBrother -TODO: Write a gem description +RailsBigBrother lets you log every create, update and destroy on any of your models. ## Installation @@ -18,7 +18,47 @@ Or install it yourself as: ## Usage -TODO: Write usage instructions here +Simply add this line in the model you want to log : +```ruby +big_brother_watch +``` + +### Define log format + +The default log format is : +```ruby +"%s;%s;%s;%s;%s;%s;%s" +``` + +To define a new format, add this in an initializer : +```ruby +RailsBigBrother.format = "new_format" +``` + +### Choose events to log + +You can choose which events to log with the `on` option. For example : +```ruby +class Example < ActiveRecord::Base + big_brother_watch on: [:create, :destroy] +end +``` + +### Select attributes to log + +You can specify attributes to monitor with `only` : +```ruby +class Example < ActiveRecord::Base + big_brother_watch only: [:first, :second] +end +``` + +You can also ignore some attributes with `ignore` : +```ruby +class Example < ActiveRecord::Base + big_brother_watch ignore: :third +end +``` ## Contributing