Sha256: 266867f0960814751298a87b1579d4611cdb98aca78cdcc2d3ea3bfecf6f4b4a
Contents?: true
Size: 841 Bytes
Versions: 12
Compression:
Stored size: 841 Bytes
Contents
module EitilSupport::Stack::Audit extend ActiveSupport::Concern included do private after_create :add_stacktrace_to_audit after_update :add_stacktrace_to_audit def add_stacktrace_to_audit audited_columns = self.class.audited_columns changed_columns = previous_changes.keys return unless (audited_columns & changed_columns).any? # .report_app_calls filters the stack on calls whose path include "/app/", since # audits otherwise tend to grow very big, which might endanger the database. stacktrace = EitilSupport::Stack.new.report_app_calls return if stacktrace.blank? # Safe operator in order to avoid raising a NoMetodError when the record # has no audits yet. self.audits.last&.update(stacktrace: stacktrace) end end end
Version data entries
12 entries across 12 versions & 1 rubygems