Module: CollectiveIdea::Acts::Audited::SingletonMethods
- Defined in:
- lib/acts_as_audited.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 #Audit.as_user.
235 236 237 |
# File 'lib/acts_as_audited.rb', line 235 def audit_as( user, &block ) Audit.as_user( user, &block ) end |
#audited_columns ⇒ Object
Returns an array of columns that are audited. See non_audited_columns
208 209 210 |
# File 'lib/acts_as_audited.rb', line 208 def audited_columns self.columns.select { |c| !non_audited_columns.include?(c.name) } end |
#disable_auditing ⇒ Object
224 225 226 |
# File 'lib/acts_as_audited.rb', line 224 def disable_auditing write_inheritable_attribute :auditing_enabled, false end |
#enable_auditing ⇒ Object
228 229 230 |
# File 'lib/acts_as_audited.rb', line 228 def enable_auditing write_inheritable_attribute :auditing_enabled, true end |
#without_auditing(&block) ⇒ Object
Executes the block with auditing disabled.
Foo.without_auditing do
@foo.save
end
218 219 220 221 222 |
# File 'lib/acts_as_audited.rb', line 218 def without_auditing(&block) auditing_was_enabled = auditing_enabled disable_auditing returning(block.call) { enable_auditing if auditing_was_enabled } end |