tangledwires-audited 6.1.0 → 6.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: 507060b1f315f6717ec1e775cf833f5852e0dd2c4da215f4fc2e20a92cc235b1
4
- data.tar.gz: e095c4936da3b523c7b41643e6be57c57b0f52972271fbb73f77aaf06ad2bc8d
3
+ metadata.gz: 8595ede793eed6955e5140df3030c279680e85a65d9497f924e96a6f801169a1
4
+ data.tar.gz: 1fef5c05d2e1e9d2e7e0342a550b587fca3b77060ce2aa716de2cfd82c6f56a0
5
5
  SHA512:
6
- metadata.gz: 9fd44157f109e50db326dd98aa06137d8f33b2ad7dac362fc8cac4e44a92639db612320047e63f7aab6c7a27b6767602109ddf0315af857ef6b38c21c49c1744
7
- data.tar.gz: b78b6f4144522904004a67be2cdec792efdc2e99ae96845c2c99d2121e93c14162bac4b22c158901aeb5ff37fc17549d373ab97726bdbd07361e6c6486474cb7
6
+ metadata.gz: cb0a4d73b7a68a1891c00204f2d84fa611d451f6e332e378d9dfa042a80e5f75746e4560a099fd944dc2ecc8cb3d3dbb27e2762448b1dff983c506524bfc50be
7
+ data.tar.gz: 0c636c2739c5be06a4eb055893cfeda5b3ef1be0d0b31914f5b6e8d1ab0dbd8589ce992913a9e588db3df22d8c7f072a66c04c770584603fc371c87de1311c26
data/README.md CHANGED
@@ -6,11 +6,13 @@ TangledWires Audited
6
6
 
7
7
  **Audited** (previously acts_as_audited) is an ORM extension that logs all changes to your models. Audited can also record who made those changes, save comments and associate models related to the changes.
8
8
 
9
- Audited currently (5.6) works with Rails 8.0, 7.2, 7.1, 7.0.
9
+ Audited currently (6.2) works with Rails 8.0, 7.2, 7.1, 7.0.
10
10
 
11
11
  ## Changes from `collectiveidea/audited`
12
12
  * Remove support for Rails versions below 7.0
13
13
  * Add support for auditing HABTM associations
14
+ * Allow multiple associated audits ([collectiveidea/audited#406](https://github.com/collectiveidea/audited/pull/406))
15
+ * Add an option to redact a record's audits when the record is deleted
14
16
 
15
17
  ## Supported Rubies
16
18
 
@@ -58,6 +58,13 @@ module Audited
58
58
  # end
59
59
  # end
60
60
  #
61
+ # * +redact_after_destroy+ - If an array is passed, the columns in the array
62
+ # will be redacted from audits when the record is destroyed.
63
+ #
64
+ # class User < ActiveRecord::Base
65
+ # audited redact_after_destroy: [:name, :email, :address]
66
+ # end
67
+ #
61
68
  def audited(options = {})
62
69
  audited? ? update_audited_options(options) : set_audit(options)
63
70
  end
@@ -90,6 +97,7 @@ module Audited
90
97
  before_update :audit_update if audited_options[:on].include?(:update)
91
98
  after_touch :audit_touch if audited_options[:on].include?(:touch) && ::ActiveRecord::VERSION::MAJOR >= 6
92
99
  before_destroy :audit_destroy if audited_options[:on].include?(:destroy)
100
+ after_destroy :redact_after_destroy unless audited_options[:redact_after_destroy].nil?
93
101
 
94
102
  reflect_on_all_associations(:has_and_belongs_to_many).each do |reflection|
95
103
  associated_model = reflection.name
@@ -430,6 +438,16 @@ module Audited
430
438
  end
431
439
  end
432
440
 
441
+ def redact_after_destroy
442
+ audits.each do |audit|
443
+ filter_attr_values(
444
+ audited_changes: audit.audited_changes,
445
+ attrs: Array(audited_options[:redact_after_destroy]).map(&:to_s),
446
+ placeholder: audited_options[:redaction_value] || REDACTED
447
+ )
448
+ end
449
+ end
450
+
433
451
  def write_audit(attrs)
434
452
  self.audit_comment = nil
435
453
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Audited
4
- VERSION = "6.1.0"
4
+ VERSION = "6.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tangledwires-audited
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TangledWires Ltd
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  - !ruby/object:Gem::Version
237
237
  version: '0'
238
238
  requirements: []
239
- rubygems_version: 4.0.3
239
+ rubygems_version: 4.0.6
240
240
  specification_version: 4
241
241
  summary: Log all changes to your models
242
242
  test_files: []