store_attribute 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5de07480a22b55413fe34512b0d36a6572da92390c998dcc1ad7838866667e5c
4
- data.tar.gz: 78d3d38f95d1f614f6d9233f0a0bfa52b67a65853f741fedbb8ff510e38e6988
3
+ metadata.gz: adaa8107d5917cf34ec29623a75a16fd14b7c5231ee57c7b6c0d3fdac1632b42
4
+ data.tar.gz: 8b7a96bc6da2779a1c7812d453374b312a52c77068511796c0199617f875d2e7
5
5
  SHA512:
6
- metadata.gz: 3831baa1c5de7d7dee01dfe5ee0be5a1478b95a2e110c37e1c9ebd405c1246e300cc4eadbbf0b3e83742c8ea258db7399ddd0dc3df10c8797e7b911428bbd3e9
7
- data.tar.gz: 774eb359b1ba5e02022f7e931089990f0d169116cbd8f9c725bc7f8bfa8189dce9c649ca3b7b3face0eccbca13b73dbb2a1028ab6f282dfe797b65adffab627c
6
+ metadata.gz: 9fb0f5ae8ac985d43c909df92930e8a60dcf8910d967a563b23524021ab8acc014fa6e83cbcca6687855c2372c48450a65b5ebb801475f1dd0a7100a9a7a8a6c
7
+ data.tar.gz: 54703853d6172fd22bd54bec3460045dd298aeb12984bd6763b45a8a48943f6ff20329cef4b744bfd36732bb5e1a3ff0bac97f82fb15cf06b170b1592025d577
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.9.2 (2021-10-13)
6
+
7
+ - Fix bug with store mutation during changes calculation. ([@palkan][])
8
+
5
9
  ## 0.9.1
6
10
 
7
11
  - Fix bug with dirty nullable stores. ([@palkan][])
@@ -186,12 +186,11 @@ module ActiveRecord
186
186
  def _define_dirty_tracking_methods(store_attribute, keys, prefix: nil, suffix: nil)
187
187
  _store_accessors_module.module_eval do
188
188
  define_method("changes") do
189
- return @changes if defined?(@changes)
190
189
  changes = super()
191
190
  self.class.local_stored_attributes.each do |accessor, attributes|
192
191
  next unless attribute_changed?(accessor)
193
192
 
194
- prev_store, new_store = changes[accessor]
193
+ prev_store, new_store = changes[accessor].map(&:dup)
195
194
 
196
195
  prev_store&.each do |key, value|
197
196
  if new_store[key] == value
@@ -199,8 +198,10 @@ module ActiveRecord
199
198
  new_store&.except!(key)
200
199
  end
201
200
  end
201
+
202
+ changes[accessor] = prev_store, new_store
202
203
  end
203
- @changes = changes
204
+ changes
204
205
  end
205
206
 
206
207
  keys.flatten.each do |key|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StoreAttribute # :nodoc:
4
- VERSION = "0.9.1"
4
+ VERSION = "0.9.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: store_attribute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2021-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord