def audit_enabled(opts={})
      include InstanceMethods

      class_attribute :auditing_fields

      has_many :audits, :as => :auditable, :order => 'created_at DESC, id DESC'

      self.auditing_fields = gather_fields_for_auditing(opts[:fields])

      after_create :log_creation
      after_update :log_update
    end
def audit_enabled(opts={})
      include InstanceMethods

      class_attribute :auditing_fields

      has_many :audits, :as => :auditable, :order => 'created_at DESC, id DESC'

      self.auditing_fields = gather_fields_for_auditing(opts[:fields])

      after_create :log_creation
      after_update :log_update
    end
Auditing creates audit objects for a record.

 @examples
   class School < ActiveRecord::Base
      audit_enabled
   end
   class School < ActiveRecord::Base
     audit_enabled :fields => [:name, :established_on]
   end