store_attribute 2.1.0 → 2.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: afa3af4ac1b9c521e3547dffef96b70bf2b0d3c900ef2601136b2eb7d3023ea8
|
|
4
|
+
data.tar.gz: 7aa3033868705bcff1cdf90a9533c0b0cc77f13e88380d7d7f1cca2a5327e50b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c97a1ecbe6e3903b1acaca20bdac15a1e105035046270aa00d93a32068e313ac20fcb6631af78c27067f2ff87c855e32b8b6e42e7a5c42a3339938cf76c4e8ef
|
|
7
|
+
data.tar.gz: 1bc2ca346cb6356373d9a9fa99d3fc12f0571989a535096920c740b138fd38027cda366d5513c47e7788ce55698daa658b890dcfd7f647fbc79edcd14ee29a12
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## master
|
|
4
4
|
|
|
5
|
+
## 2.2.0 (2026-07-17)
|
|
6
|
+
|
|
7
|
+
- Add regression coverage for store key dirty-tracking methods (`saved_change_to_KEY?`, `KEY_changed?`, `KEY_was`, `KEY_change`, `KEY_before_last_save`), which rely on `TypedStore` delegating `#get` to the underlying store accessor (fixed in 2.0.1). ([@palkan][])
|
|
8
|
+
|
|
9
|
+
- Defer patching Active Record via `ActiveSupport.on_load(:active_record)` so requiring the gem no longer force-loads the JSON column type before app initializers run. ([@MattyMc](https://github.com/MattyMc))
|
|
10
|
+
|
|
11
|
+
- Fix Rails 8.2 compatibility (named store accessors module). ([@palkan][])
|
|
12
|
+
|
|
13
|
+
- Cast values coming from attribute defaults ([@honeyryderchuck][]).
|
|
14
|
+
|
|
15
|
+
## 2.1.1 (2026-01-13)
|
|
16
|
+
|
|
17
|
+
- Fix defining store attributes after schema loading. ([@palkan][])
|
|
18
|
+
|
|
5
19
|
## 2.1.0 (2026-01-12)
|
|
6
20
|
|
|
7
21
|
- **Require Ruby 3.2+ and Rails 7.2+.**
|
|
@@ -135,6 +135,11 @@ module ActiveRecord
|
|
|
135
135
|
_local_typed_stored_attributes[store_name][:owner] = self if options.key?(:default) || !_local_typed_stored_attributes?
|
|
136
136
|
_local_typed_stored_attributes[store_name][:types][name] = [type, options]
|
|
137
137
|
|
|
138
|
+
# In case #decorate_attribute has already been invoked, add new type information right away
|
|
139
|
+
if (dtype = _local_typed_stored_attributes[store_name][:decorated_type])
|
|
140
|
+
dtype.add_typed_key(name, type, **options.symbolize_keys)
|
|
141
|
+
end
|
|
142
|
+
|
|
138
143
|
if store_attribute_register_attributes
|
|
139
144
|
cast_type =
|
|
140
145
|
if type == :value
|
|
@@ -206,6 +211,8 @@ module ActiveRecord
|
|
|
206
211
|
type.add_typed_key(name, cast_type, **options.symbolize_keys)
|
|
207
212
|
end
|
|
208
213
|
|
|
214
|
+
_local_typed_stored_attributes[attr_name][:decorated_type] = type
|
|
215
|
+
|
|
209
216
|
type
|
|
210
217
|
end
|
|
211
218
|
|
|
@@ -265,6 +272,19 @@ module ActiveRecord
|
|
|
265
272
|
end
|
|
266
273
|
end
|
|
267
274
|
end
|
|
275
|
+
|
|
276
|
+
unless method_defined?(:_store_accessors_module)
|
|
277
|
+
# Rails 8.2 introduced named accessors module
|
|
278
|
+
def _store_accessors_module
|
|
279
|
+
if const_defined?(:GeneratedStoreMethods, false)
|
|
280
|
+
const_get(:GeneratedStoreMethods, false)
|
|
281
|
+
else
|
|
282
|
+
mod = const_set(:GeneratedStoreMethods, Module.new)
|
|
283
|
+
include mod # rubocop:disable Layout/EmptyLinesAfterModuleInclusion
|
|
284
|
+
mod
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|
|
268
288
|
end
|
|
269
289
|
end
|
|
270
290
|
end
|
|
@@ -52,7 +52,7 @@ module ActiveRecord
|
|
|
52
52
|
if hash.key?(key)
|
|
53
53
|
hash[key] = type.deserialize(hash[key])
|
|
54
54
|
elsif fallback_to_default?(key)
|
|
55
|
-
hash[key] = built_defaults[key]
|
|
55
|
+
hash[key] = type.deserialize(built_defaults[key])
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
hash
|
|
@@ -82,7 +82,7 @@ module ActiveRecord
|
|
|
82
82
|
if hash.key?(key)
|
|
83
83
|
hash[key] = type.cast(hash[key])
|
|
84
84
|
elsif fallback_to_default?(key)
|
|
85
|
-
hash[key] = built_defaults[key]
|
|
85
|
+
hash[key] = type.cast(built_defaults[key])
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
hash
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: store_attribute
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- palkan
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.0
|
|
32
|
+
version: 0.2.0
|
|
33
33
|
type: :development
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.0
|
|
39
|
+
version: 0.2.0
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: rake
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|