Module: AppmospheresAudit::RecordTrail
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/appmospheres_audit.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#track_create ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/appmospheres_audit.rb', line 58 def track_create begin EventLog.create!(:event_type => self.class.to_s, :action => "create", :payload => self.id.to_yaml) rescue Rails.logger.warn "Could not log event 'create' for #{self.class.to_s}:#{self.id}" rescue true end end |
#track_destroy ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/appmospheres_audit.rb', line 76 def track_destroy begin filtered_params = Rails.application.config.filter_parameters + (AppmospheresAudit.filter_parameters || []) EventLog.create!(:event_type => self.class.to_s, :action => "destroy", :payload => self.serializable_hash.except(*filtered_params.map(&:to_s)).to_yaml) rescue Rails.logger.warn "Could not log event 'destroy' for #{self.class.to_s}:#{self.inspect}" rescue true end end |
#track_update ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/appmospheres_audit.rb', line 66 def track_update begin filtered_params = Rails.application.config.filter_parameters + (AppmospheresAudit.filter_parameters || []) EventLog.create!(:event_type => self.class.to_s, :action => "update", :payload => self.changes.merge({:id => self.id}).except(*filtered_params).to_yaml) rescue Rails.logger.warn "Could not log event 'update' for #{self.class.to_s}:#{self.changes.inspect}" rescue true end end |