Sha256: 80b89ede333b0288cad0628425ac9446debcd2fa38f4f47d06fcb5a5f05d8d67
Contents?: true
Size: 973 Bytes
Versions: 19
Compression:
Stored size: 973 Bytes
Contents
module ActsAsAuditable def self.included(base) base.extend(ClassMethods) end module ClassMethods def acts_as_auditable(options = {}) self.cattr_accessor :auditable_options class_eval <<-EOV include ActsAsAuditable::InstanceMethods after_create :audit_create after_destroy :audit_destroy after_update :audit_update EOV acts_as_auditable_options(options) end def acts_as_auditable_options(options = {}) self.auditable_options = options end end module InstanceMethods def audit_create Appstats::Audit.audit_create(self,self.class.auditable_options) end def audit_destroy Appstats::Audit.audit_destroy(self,self.class.auditable_options) end def audit_update Appstats::Audit.audit_update(self,self.class.auditable_options) end end end ActiveRecord::Base.class_eval { include ActsAsAuditable }
Version data entries
19 entries across 19 versions & 1 rubygems