Module: Audited::Auditor::AuditedClassMethods
- Defined in:
- lib/audited/auditor.rb
Overview
InstanceMethods
Instance Method Summary collapse
-
#audit_as(user, &block) ⇒ Object
All audit operations during the block are recorded as being made by
user
. -
#audited_columns ⇒ Object
Returns an array of columns that are audited.
- #disable_auditing ⇒ Object
- #enable_auditing ⇒ Object
-
#without_auditing(&block) ⇒ Object
Executes the block with auditing disabled.
Instance Method Details
#audit_as(user, &block) ⇒ Object
All audit operations during the block are recorded as being made by user
. This is not model specific, the method is a convenience wrapper around
444 445 446 |
# File 'lib/audited/auditor.rb', line 444 def audit_as( user, &block ) Audited.audit_class.as_user( user, &block ) end |
#audited_columns ⇒ Object
Returns an array of columns that are audited. See non_audited_columns
416 417 418 |
# File 'lib/audited/auditor.rb', line 416 def audited_columns self.columns.select { |c| !non_audited_columns.include?(c.name) } end |
#disable_auditing ⇒ Object
432 433 434 |
# File 'lib/audited/auditor.rb', line 432 def disable_auditing self.auditing_enabled = false end |
#enable_auditing ⇒ Object
436 437 438 |
# File 'lib/audited/auditor.rb', line 436 def enable_auditing self.auditing_enabled = true end |
#without_auditing(&block) ⇒ Object
Executes the block with auditing disabled.
Foo.without_auditing do
@foo.save
end
426 427 428 429 430 |
# File 'lib/audited/auditor.rb', line 426 def without_auditing(&block) auditing_was_enabled = auditing_enabled disable_auditing block.call.tap { enable_auditing if auditing_was_enabled } end |