AuditedController
This gem is extracted from the real working code. the requirements is also from the real requirements:
- the users want to track the user's actions.
- should log into database.
- there're not so many requests in a second.
Installation
Add this line to your application's Gemfile:
gem 'audited_controller'
And then execute:
$ bundle
Or install it yourself as:
$ gem install audited_controller
Then create a file : config/audits.yml, and (TODO: make this a task )
Usage
- assuming you want to track the actions of your 'users_controller'. add 'before_filter :add_to_audit' to the target controller.
class UsersController < ApplicationController before_filter :add_to_audit def index # ... end def create # ... end end
make sure the actions appear in the config/audits.yml file
this line determines if the get request should be audited.
audit_get_request: false
the lines below is used for i18n translations
format:
: users: index: open the index page of messages create: create an message
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request