Audit Record

A simple gem built for Rails 3+ which creates an audit record when users trigger events you flag. The events you can trigger audit on are:

  1. When attributes changing in a model

  2. When specific methods of a class are executed

  3. When you trigger an AuditRecord through code as part of a manual audit process

Installation

In Gemfile:

gem “audit_record”

In your application root, run:

$ bundle install

Generate the migration:

After running one of the generators: $ rake db:migrate

Usage

class User < ActiveRecord::Base
  audit :attributes => [:name, :is_admin], :methods => [:unlock_account!, :destroy]
end

Contributing to audit

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Special Thanks

Much of Audit was inspired by acts_as_audited, which is a fine gem in its own right. github.com/collectiveidea/acts_as_audited

However, my goal was to strip features down as much as possible and lock audits (where possible) to the model methods and attributes.

Copyright © 2012 Mark Daggett. See LICENSE.txt for further details.