model_timeline 0.1.5 → 0.1.6
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/lib/model_timeline/timelineable.rb +5 -4
- data/lib/model_timeline/version.rb +1 -1
- 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: 1c30cebe3384befbd1426f028e64ca6b35a39914a31aad9fc34205184b926ead
|
|
4
|
+
data.tar.gz: 9d7ed5bc145879fb09c6e664c2587c32c70f25266ac1c7a1db5b7fd11b128725
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47632a6615d0f07b8846c03825148c4d3222a81b9452d3e82116fe5e57c6fba72437a499ac315b1b3f8bd0b0b2358798a0f050c3d3f023afb7e994cf0a306fde
|
|
7
|
+
data.tar.gz: 050b15609e6b6cb2f9cbe08bf8939bf8b4f204b073049d42f847577f4bc235b3a5fa45dcc457412db4d15dca65aa1ca41720dc430deac0ccfa7433e36258a39a
|
|
@@ -100,12 +100,13 @@ module ModelTimeline
|
|
|
100
100
|
config = ModelTimeline::Timelineable.logger_store[config_key]
|
|
101
101
|
return unless config
|
|
102
102
|
|
|
103
|
-
object_changes = filter_attributes(previous_changes, config)
|
|
104
|
-
return if object_changes.empty?
|
|
105
|
-
|
|
106
103
|
action = previously_new_record? ? :create : :update
|
|
107
104
|
return unless config[:on].include?(action)
|
|
108
105
|
|
|
106
|
+
current_changes = action == :create ? attributes.transform_values { |v| [nil, v] } : previous_changes
|
|
107
|
+
object_changes = filter_attributes(current_changes, config)
|
|
108
|
+
return if object_changes.empty?
|
|
109
|
+
|
|
109
110
|
config[:klass].create!(
|
|
110
111
|
timelineable_type: self.class.name,
|
|
111
112
|
timelineable_id: id,
|
|
@@ -132,7 +133,7 @@ module ModelTimeline
|
|
|
132
133
|
timelineable_type: self.class.name,
|
|
133
134
|
timelineable_id: id,
|
|
134
135
|
action: 'destroy',
|
|
135
|
-
object_changes: attributes.transform_values { |v| [v, nil] },
|
|
136
|
+
object_changes: filter_attributes(attributes.transform_values { |v| [v, nil] }, config),
|
|
136
137
|
metadata: object_metadata(config),
|
|
137
138
|
ip_address: current_ip_address,
|
|
138
139
|
**current_user_attributes,
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: model_timeline
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexandre Stapenhorst
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-06-
|
|
11
|
+
date: 2025-06-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pg
|