AuditedController

This gem is extracted from the real working code. the requirements is also from the real requirements:

  1. the users want to track the user's actions.
  2. should log into database.
  3. 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

  1. 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

  1. 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

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request