Method: Auditable::Auditing::ClassMethods#audit
- Defined in:
- lib/auditable/auditing.rb
#audit(*options) ⇒ Object
Set the list of methods to track over record saves
Example:
class Survey < ActiveRecord::Base
audit :page_count, :question_ids
end
25 26 27 28 29 30 31 |
# File 'lib/auditable/auditing.rb', line 25 def audit(*) has_many :audits, :class_name => "Auditable::Audit", :as => :auditable after_create {|record| record.snap!(:action => "create")} after_update {|record| record.snap!(:action => "update")} self.audited_attributes = Array.wrap end |