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.
- #auditing_enabled ⇒ Object
- #auditing_enabled=(val) ⇒ Object
- #disable_auditing ⇒ Object
- #enable_auditing ⇒ Object
-
#without_auditing ⇒ 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
268 269 270 |
# File 'lib/audited/auditor.rb', line 268 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
238 239 240 |
# File 'lib/audited/auditor.rb', line 238 def audited_columns self.columns.select { |c| !non_audited_columns.include?(c.name) } end |
#auditing_enabled ⇒ Object
272 273 274 |
# File 'lib/audited/auditor.rb', line 272 def auditing_enabled Audited.store.fetch("#{name.tableize}_auditing_enabled", true) end |
#auditing_enabled=(val) ⇒ Object
276 277 278 |
# File 'lib/audited/auditor.rb', line 276 def auditing_enabled= val Audited.store["#{name.tableize}_auditing_enabled"] = val end |
#disable_auditing ⇒ Object
256 257 258 |
# File 'lib/audited/auditor.rb', line 256 def disable_auditing self.auditing_enabled = false end |
#enable_auditing ⇒ Object
260 261 262 |
# File 'lib/audited/auditor.rb', line 260 def enable_auditing self.auditing_enabled = true end |
#without_auditing ⇒ Object
Executes the block with auditing disabled.
Foo.without_auditing do
@foo.save
end
248 249 250 251 252 253 254 |
# File 'lib/audited/auditor.rb', line 248 def without_auditing auditing_was_enabled = auditing_enabled disable_auditing yield ensure enable_auditing if auditing_was_enabled end |