ActsAsCallbackLogger

This plugin is extracted from several applications where we just wanted to log callback events (after_create, after_update, after_destroy) for certain models tracking various things that users did within the application.

1) To use the plugin, you must first have a table that you would like to use for logging.

That table must have the three columns "msg", "data" and "restored_at".  An example would be:

create_table :app_logs do |t|

...
 t.column :msg, :string, :null => false
 t.column :data, :text
 t.column :restored_at, :datetime
 ...

end

2) In the model for that table add “acts_as_callback_logger”. For example:

class AppLog < ActiveRecord::Base

...
acts_as_callback_logger
...

end

3) In the model you want to log actions for add “log_callbacks”. For example:

class Program < ActiveRecord::Base

...
log_callbacks
...

end