audited 5.4.3 → 5.5.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -1
- data/lib/audited/auditor.rb +2 -1
- data/lib/audited/version.rb +1 -1
- data/spec/audited/auditor_spec.rb +8 -0
- data/spec/support/active_record/models.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d9407750d2b70edd5e934c0b0544ba52230a3e3ac4955194029b6b7370c8fe7
|
4
|
+
data.tar.gz: 863fc4f2e8d1cc188664f4a346db886f7dfdd4bf6c6b56f3371eacb4d75497dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb853e42fb4e6ff1493f3864a0c5833e730b27e90f14d8b8529ad11c3dd66052c8bd3739433e4c08decd84ecb5525a244ab8a831bf70a7a21654c398e220b8c7
|
7
|
+
data.tar.gz: 36d1acab56d4011d8766f0a3f0126ecae8fff5a7469a3ac00a43d6ccc3e1f09eee5c8e8054d30367dbdf69caab3f49135020861ca16d10a76e5f44349e14a57f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Audited ChangeLog
|
2
2
|
|
3
|
+
### 5.5.0 (2024-04-02)
|
4
|
+
|
5
|
+
- Removed support for Rails 5.0 and 5.1.
|
6
|
+
- Replace RequestStore with ActiveSupport::CurrentAttributes - @punkisdead
|
7
|
+
[#702](https://github.com/collectiveidea/audited/pull/702)
|
8
|
+
|
3
9
|
### 5.4.3 (2024-01-11)
|
4
10
|
|
5
11
|
- Ignore readonly columns in audit - @sriddbs
|
data/README.md
CHANGED
@@ -8,8 +8,9 @@ Audited
|
|
8
8
|
**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.
|
9
9
|
|
10
10
|
|
11
|
-
Audited currently (5.
|
11
|
+
Audited currently (5.5) works with Rails 7.1, 7.0, 6.1, 6.0, 5.2.
|
12
12
|
|
13
|
+
For Rails 5.0 & 5.1, use gem version 5.4.3
|
13
14
|
For Rails 4, use gem version 4.x
|
14
15
|
For Rails 3, use gem version 3.0 or see the [3.0-stable branch](https://github.com/collectiveidea/audited/tree/3.0-stable).
|
15
16
|
|
data/lib/audited/auditor.rb
CHANGED
@@ -249,6 +249,8 @@ module Audited
|
|
249
249
|
all_changes.except(*self.class.non_audited_columns)
|
250
250
|
end
|
251
251
|
|
252
|
+
filtered_changes = normalize_enum_changes(filtered_changes)
|
253
|
+
|
252
254
|
if for_touch && (last_audit = audits.last&.audited_changes)
|
253
255
|
filtered_changes.reject! do |k, v|
|
254
256
|
last_audit[k].to_json == v.to_json ||
|
@@ -258,7 +260,6 @@ module Audited
|
|
258
260
|
|
259
261
|
filtered_changes = redact_values(filtered_changes)
|
260
262
|
filtered_changes = filter_encrypted_attrs(filtered_changes)
|
261
|
-
filtered_changes = normalize_enum_changes(filtered_changes)
|
262
263
|
filtered_changes.to_hash
|
263
264
|
end
|
264
265
|
|
data/lib/audited/version.rb
CHANGED
@@ -540,6 +540,14 @@ describe Audited::Auditor do
|
|
540
540
|
expect(user.audits.last.action).to eq("update")
|
541
541
|
expect(user.audits.last.audited_changes.keys).to eq(%w[suspended_at])
|
542
542
|
end
|
543
|
+
|
544
|
+
it "updating nested resource through parent while changing an enum on parent shouldn't double audit" do
|
545
|
+
user.status = :reliable
|
546
|
+
user.companies_attributes = [{name: "test"}]
|
547
|
+
expect { user.save }.to change(user.audits, :count).from(1).to(2)
|
548
|
+
expect(user.audits.last.action).to eq("update")
|
549
|
+
expect(user.audits.last.audited_changes.keys).to eq(%w[status])
|
550
|
+
end
|
543
551
|
end
|
544
552
|
|
545
553
|
context "after updating" do
|
@@ -136,6 +136,7 @@ module Models
|
|
136
136
|
has_associated_audits
|
137
137
|
has_many :companies, class_name: "OwnedCompany", dependent: :destroy
|
138
138
|
accepts_nested_attributes_for :companies
|
139
|
+
enum status: {active: 0, reliable: 1, banned: 2}
|
139
140
|
end
|
140
141
|
|
141
142
|
class OwnedCompany < ::ActiveRecord::Base
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audited
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Keepers
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2024-
|
16
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: activerecord
|