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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9b06a537daa1e546effd75438c323e45060d950bde291820a0e04365dac9282
4
- data.tar.gz: f691d5563a5da5ff7d6871e99025b6c0bee18ad5dd0bbeaaec428335cfb258a0
3
+ metadata.gz: 1c30cebe3384befbd1426f028e64ca6b35a39914a31aad9fc34205184b926ead
4
+ data.tar.gz: 9d7ed5bc145879fb09c6e664c2587c32c70f25266ac1c7a1db5b7fd11b128725
5
5
  SHA512:
6
- metadata.gz: e0d0b6345364466a0145064b690888f50817cd81f9bbc3745cff3e732cf59377e3cad27bd32f6a1ffa4b9a1051385f398b6db86e3e2e631d6170c3de849c1078
7
- data.tar.gz: dff77944a1c78176c7c84a32b41efe282648ca1ca091c83823563ed81a3b58ea41ab6068cc3f879028b99375f9e25863d92abe11c82b051ebd589349b9741e02
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,
@@ -5,5 +5,5 @@ module ModelTimeline
5
5
  # Follows semantic versioning (https://semver.org/).
6
6
  #
7
7
  # @return [String] The current version in the format "MAJOR.MINOR.PATCH"
8
- VERSION = '0.1.5'
8
+ VERSION = '0.1.6'
9
9
  end
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.5
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-05 00:00:00.000000000 Z
11
+ date: 2025-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg