store_attribute 2.0.1 → 2.1.1
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 +11 -0
- data/README.md +3 -10
- data/lib/store_attribute/active_record/store.rb +10 -1
- data/lib/store_attribute/version.rb +1 -1
- metadata +9 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34f29a54cc5ccce123dd195448e665f646c8074d8bf4fefa72a3eec1c18a94bc
|
|
4
|
+
data.tar.gz: 3deb3c7cd449df71ee289e7967864db8c6e223fdc6fb0f912b1a919560a6c991
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 739f05b7c5c44430560a3392686c2f1ccc536fb4a6f529b56d567935667e10a96165de00962d89c91b5bcb8d12704fd2b475beeb5164507bc007fd3285996958
|
|
7
|
+
data.tar.gz: a147f51114c74db06596d2068c4ef83db35785519211a15e1dc0f345540abafc826badd75fd877beb72b5f1d4c04b34f47ea6938ac9a432e8f65f6d821985d44
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## master
|
|
4
4
|
|
|
5
|
+
## 2.1.1 (2026-01-13)
|
|
6
|
+
|
|
7
|
+
- Fix defining store attributes after schema loading. ([@palkan][])
|
|
8
|
+
|
|
9
|
+
## 2.1.0 (2026-01-12)
|
|
10
|
+
|
|
11
|
+
- **Require Ruby 3.2+ and Rails 7.2+.**
|
|
12
|
+
|
|
13
|
+
- Fix type lookup issue when registering store_attributes as attributes. ([@n-ivan][])
|
|
14
|
+
|
|
5
15
|
## 2.0.1 (2025-05-09) 🎇
|
|
6
16
|
|
|
7
17
|
- Register store_attributes as attributes. ([@rickcsong](https://github.com/rickcsong))
|
|
@@ -146,3 +156,4 @@ See [PR#22](https://github.com/palkan/store_attribute/pull/22).
|
|
|
146
156
|
[@glaszig]: https://github.com/glaszig
|
|
147
157
|
[@ioki-klaus]: https://github.com/ioki-klaus
|
|
148
158
|
[@markedmondson]: https://github.com/markedmondson
|
|
159
|
+
[@n-ivan]: https://github.com/n-ivan
|
data/README.md
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
## Store Attribute
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Active Record extension which adds type casting support to store accessors.
|
|
8
8
|
|
|
9
|
-
Originally extracted from
|
|
9
|
+
Originally extracted from the (unmerged) PR to Ruby on Rails: [rails/rails#18942](https://github.com/rails/rails/pull/18942).
|
|
10
10
|
|
|
11
11
|
### Install
|
|
12
12
|
|
|
13
13
|
In your Gemfile:
|
|
14
14
|
|
|
15
15
|
```ruby
|
|
16
|
-
# for Rails 6.1+
|
|
16
|
+
# for Rails 6.1+
|
|
17
17
|
gem "store_attribute", "~> 1.0"
|
|
18
18
|
|
|
19
19
|
# for Rails 5+ (6 is supported)
|
|
@@ -177,13 +177,6 @@ StoreAttribute.store_attribute_unset_values_fallback_to_default = false
|
|
|
177
177
|
|
|
178
178
|
Bug reports and pull requests are welcome on GitHub at [https://github.com/palkan/store_attribute](https://github.com/palkan/store_attribute).
|
|
179
179
|
|
|
180
|
-
For local development, you'll need PostgreSQL up and running. You can either install it on your host machine or run via Docker as follows:
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
docker run --name store_attribute_postgres -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_USER=$USER -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres
|
|
184
|
-
docker exec -it store_attribute_postgres createdb -U $USER store_attribute_test
|
|
185
|
-
```
|
|
186
|
-
|
|
187
180
|
## License
|
|
188
181
|
|
|
189
182
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
@@ -135,12 +135,19 @@ 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
|
|
141
146
|
ActiveModel::Type::Value.new(**options.except(:default))
|
|
142
|
-
|
|
147
|
+
elsif type.is_a?(Symbol)
|
|
143
148
|
ActiveRecord::Type.lookup(type, **options.except(:default))
|
|
149
|
+
else
|
|
150
|
+
type
|
|
144
151
|
end
|
|
145
152
|
|
|
146
153
|
attribute(name, cast_type, **options)
|
|
@@ -204,6 +211,8 @@ module ActiveRecord
|
|
|
204
211
|
type.add_typed_key(name, cast_type, **options.symbolize_keys)
|
|
205
212
|
end
|
|
206
213
|
|
|
214
|
+
_local_typed_stored_attributes[attr_name][:decorated_type] = type
|
|
215
|
+
|
|
207
216
|
type
|
|
208
217
|
end
|
|
209
218
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: store_attribute
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- palkan
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activerecord
|
|
@@ -16,28 +15,28 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '7.2'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
25
|
+
version: '7.2'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: pglite
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
32
|
+
version: 0.0.5
|
|
34
33
|
type: :development
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
39
|
+
version: 0.0.5
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
41
|
name: rake
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -91,7 +90,6 @@ metadata:
|
|
|
91
90
|
documentation_uri: http://github.com/palkan/store_attribute
|
|
92
91
|
homepage_uri: http://github.com/palkan/store_attribute
|
|
93
92
|
source_code_uri: http://github.com/palkan/store_attribute
|
|
94
|
-
post_install_message:
|
|
95
93
|
rdoc_options: []
|
|
96
94
|
require_paths:
|
|
97
95
|
- lib
|
|
@@ -99,15 +97,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
99
97
|
requirements:
|
|
100
98
|
- - ">="
|
|
101
99
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 3.
|
|
100
|
+
version: 3.2.0
|
|
103
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
102
|
requirements:
|
|
105
103
|
- - ">="
|
|
106
104
|
- !ruby/object:Gem::Version
|
|
107
105
|
version: '0'
|
|
108
106
|
requirements: []
|
|
109
|
-
rubygems_version: 3.
|
|
110
|
-
signing_key:
|
|
107
|
+
rubygems_version: 3.6.9
|
|
111
108
|
specification_version: 4
|
|
112
109
|
summary: ActiveRecord extension which adds typecasting to store accessors
|
|
113
110
|
test_files: []
|