Authors: | Igor Alexandrov (igor.alexandrov@gmail.com) |
Copyright: | Copyright © 2010 Igor Alexandrov. All rights reserved. |
License: | MIT License (opensource.org/licenses/mit-license.php) |
Website: | http://github.com/igor-alexandrov/acts_as_protocolable |
When do you need it?
It is very useful gem if you want to provide a system activity page inside your backend.
How to use it? Look over next chapter.
How to install and use it?
Install a gem.
sudo gem install acts_as_protocolable
Generate migration and run it.
./script/generate acts_as_protocolable_migration
rake db:migrate
Now a bit of configuration.
# config/environment.rb
config.gem 'acts_as_protocolable'
# app/controllers/admin/admin_controller.rb class Admin::AdminController < ApplicationController before_filter :set_internal_user_id
def set_internal_user_id ActsAsProtocolable.internal_user_id = current_user.id end end
Use it!
class YourModel < ActiveRecord::Base
acts_as_protocolable
end
Or with parameters.
class YourAnotherModel < ActiveRecord::Base
acts_as_protocolable(
:only => ['create', 'update']
)
end