journaled 5.1.1 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d27e8931e64963620ecd1fd44c4a46c244470a6715dc19c56a7a1a29aaa97b6
4
- data.tar.gz: f95df32775abd3f65cb8d526c60fae948fc69425957a378e4007765fdade14c0
3
+ metadata.gz: 7fc4b493edc90534706cd22dbb1fae76cdacc693d95e44734f9ce92db2d0716c
4
+ data.tar.gz: 46edc5873055e2a4e7ceae9f8dc63c558b331a821826803cd36aa971b42258f5
5
5
  SHA512:
6
- metadata.gz: 1cd4a144b2cc6dbb398b082dfe97b93829ab5d0e2ad7c22fb807ff63be9d9f5e1b24278db14eb947ce247c92f8fd09e135010ce9bc546e6e34589f98fdccaeb9
7
- data.tar.gz: 10da7fde07cfe2e7d654978a99c0734976f7199efd1d1d5e6aa11684d30d537d625acf238e0f636f8dec75b298920a8bf3f64a8c41105ddab40f624b03f1e8d6
6
+ metadata.gz: 6c9871cbc8b6439f9d29e29bbc24068d2a25667eb42003bed42ca016505b463586b8b3bc0b4c33d2f130a76d5dbc70bf7815d41b992def7a8dc4f71e697113e8
7
+ data.tar.gz: 6770fd7d6a3c92bce0122def374fa1a7e31f74c8a67d8ebeb9c2ccf5e1e02c616aae42274b5fd145e6cd59d6aa7e5b483dca134d8479822652e65c0bd7c1df84
data/README.md CHANGED
@@ -345,6 +345,15 @@ Journaled::AuditLog.with_snapshots do
345
345
  end
346
346
  ```
347
347
 
348
+ Snapshots can also be enabled globally for all _deletion_ operations. Since
349
+ `changes` will be empty on deletion, you should consider using this if you care
350
+ about the contents of any records being deleted (and/or don't have a full audit
351
+ trail from their time of creation):
352
+
353
+ ```ruby
354
+ Journaled::AuditLog.snapshot_on_deletion = true
355
+ ```
356
+
348
357
  Events with snapshots will continue to populate the `changes` field, but will
349
358
  additionally contain a snapshot with the full state of the user:
350
359
 
@@ -58,7 +58,8 @@ module Journaled
58
58
  end
59
59
 
60
60
  def snapshot
61
- filtered_attributes if record._log_snapshot || AuditLog.snapshots_enabled
61
+ filtered_attributes if record._log_snapshot || AuditLog.snapshots_enabled ||
62
+ (database_operation == 'delete' && AuditLog.snapshot_on_deletion)
62
63
  end
63
64
 
64
65
  def actor
@@ -18,6 +18,7 @@ module Journaled
18
18
  mattr_accessor(:default_enqueue_opts) { {} }
19
19
  mattr_accessor(:excluded_classes) { DEFAULT_EXCLUDED_CLASSES.dup }
20
20
  thread_mattr_accessor(:snapshots_enabled) { false }
21
+ thread_mattr_accessor(:snapshot_on_deletion) { false }
21
22
  thread_mattr_accessor(:_disabled) { false }
22
23
  thread_mattr_accessor(:_force) { false }
23
24
 
@@ -1,3 +1,3 @@
1
1
  module Journaled
2
- VERSION = "5.1.1".freeze
2
+ VERSION = "5.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journaled
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Lipson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2022-09-16 00:00:00.000000000 Z
14
+ date: 2022-10-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activejob