Module: AuditModel::Models::Helpers::ClassMethods
- Defined in:
- lib/audit_model/models/helpers.rb
Instance Method Summary collapse
- #auditable(options = {}) ⇒ Object
- #disable_audit ⇒ Object
- #enable_audit ⇒ Object
- #without_audit ⇒ Object
Instance Method Details
#auditable(options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/audit_model/models/helpers.rb', line 7 def auditable( = {}) send :include, InstanceMethods class_attribute :audit_enabled, instance_writer: false [:on] ||= [:create, :update, :destroy] setup_callbacks [:on] setup_model setup_associations send :enable_audit end |
#disable_audit ⇒ Object
26 27 28 |
# File 'lib/audit_model/models/helpers.rb', line 26 def disable_audit self.audit_enabled = false end |
#enable_audit ⇒ Object
30 31 32 |
# File 'lib/audit_model/models/helpers.rb', line 30 def enable_audit self.audit_enabled = true end |
#without_audit ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/audit_model/models/helpers.rb', line 18 def without_audit cache = audit_enabled disable_audit yield ensure enable_audit if cache end |