Plugins - acts_as_audited
Add to favoritesacts_as_audited
acts_as_audited is an ActiveRecord extension that logs all changes to your models in an audits table.
Auditing in Rails
If you’re using acts_as_audited within Rails, you can simply declare which models should be audited. acts_as_audited can also automatically record the user that made the change if your controller has a current_user method.
class ApplicationController < ActionController::Base
audit User, List, Item
protected
def current_user
@user ||= User.find(session[:user])
end
end
Customizing
To get auditing outside of Rails, or to customize which fields are audited within Rails, you can explicitly declare acts_as_audited on your models:
class User < ActiveRecord::Base
acts_as_audited :except => [:password, :mistress]
end
See http://opensoul.org/2006/07/21/acts_as_audited for more information.
Installation
# Install the plugin into your rails app
script/plugin install http://source.collectiveidea.com/public/rails/plugins/acts_as_audited
# Generate the migration
script/generate audited_migration add_audits_table
rake db:migrate
Caveats
Auditing with user support depends on Rails’ caching mechanisms, therefore auditing isn’t enabled during development mode. To test that auditing is working, start up your app in production mode, or change the following options in config/environments/environment.rb:
config.cache_classes = true config.action_controller.perform_caching = true
Upgrading
Those upgrading from version 0.2 need to add 2 fields the audits table:
add_column :audits, :user_type, :string add_column :audits, :username, :string
Brandon Keepers, Collective Idea
http://opensoul.org/tags/acts_as_audited
http://source.collectiveidea.com/public/rails/plugins/acts_as_audited
Rails' (MIT)
Model

Awesome plugin. I would really like its functionality to be extended for the ActiveResource feature of Rails 2.0.2 though. Is it already implemented?