Skip to content

Introducing: `Journaled::AuditLog`

Compare
Choose a tag to compare
@smudge smudge released this 09 Sep 19:32
· 5 commits to master since this release
6a4ec0c

This release introduces Betterment's Journaled::AuditLog mixin for ActiveRecord modules. It's similar to audit logging / papertrail-like gems, in that it will record changes to models (insert/update/delete). But instead of storing these changes in a local versions table (etc), it will emit them in the form of journaled events.

To get started, add has_audit_log to a model:

class MyModel < ApplicationRecord
  has_audit_log
  
  # ...
end

This pairs with the 5.0 release that introduced transactionally-batched journaling. (So, if you're changing several records at once within the scope of a single transaction, you'll only end up enqueuing 1 journaled event job).