Module: Auditing::Auditor
- Included in:
- Audit
- Defined in:
- lib/auditing/auditor.rb
Instance Method Summary collapse
Instance Method Details
#new_value ⇒ Object
13 14 15 16 |
# File 'lib/auditing/auditor.rb', line 13 def new_value return nil unless read_attribute(:new_value) Marshal.load( ActiveSupport::Base64.decode64( read_attribute(:new_value) ) ) end |
#old_value ⇒ Object
8 9 10 11 |
# File 'lib/auditing/auditor.rb', line 8 def old_value return nil unless read_attribute(:old_value) Marshal.load( ActiveSupport::Base64.decode64( read_attribute(:old_value) ) ) end |
#reversable? ⇒ Boolean
4 5 6 |
# File 'lib/auditing/auditor.rb', line 4 def reversable? undoable? end |
#rollback ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/auditing/auditor.rb', line 18 def rollback return unless reversable? if association.blank? auditable.update_attribute(field_name.to_sym, old_value) else association.class.find(association_id).update_attribute(field_name.to_sym, old_value) end end |