ActsAsAuditedOnSteroids

Simple solution to improve existing acts_as_audited functionality.

Example

class User < ActiveRecord::Base

def cuak
  "I love to cuak"
end  
audit_event :cuak, :with => :changes

end

class ProductsController < ApplicationController

audit_action :create, :as => :attempt, :with => Proc.new { |c| c.send :params }

def create
  @product = Product.new(params[:product])

  respond_to do |format|
    if @product.save
      flash[:notice] = 'Product was successfully created.'
      format.html { redirect_to(@product) }
      format.xml  { render :xml => @product, :status => :created, :location => @product }
    else
      format.html { render :action => "new" }
      format.xml  { render :xml => @product.errors, :status => :unprocessable_entity }
    end
  end
end

end

© Copyright 2010 Juan Manuel Barreneche and Lucas Florio. MIT. Do whatever you want.