serialize_attributes 0.3.0 → 0.3.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/lib/serialize_attributes/store.rb +9 -5
- data/lib/serialize_attributes/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: 4c06deef436a52e15560111b4055b706d769d684106edaa4d224a7121367cfde
|
4
|
+
data.tar.gz: e8bf6db9353e825f8df2cae7f79634c39826c69793a91a8dd3dba60a71c6039d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff687f3298a043cfac0a8aa00931a2175640ff538c7753be1397d15a11995b234c778e2f6454ae5c4f64dd55fe6c3774beefbff349b4c4025f3020406fddaa51
|
7
|
+
data.tar.gz: 0471ec6fb74122457517c3dceb602000114257b3cf98d5f11cac75506da0a7e0ab74554545c26caf34f16edc70f6b0f21ae8e5f81a7ffc6324e5009b7e871cb0
|
@@ -151,14 +151,18 @@ module SerializeAttributes
|
|
151
151
|
|
152
152
|
# This method wraps the original store column and catches the `deserialize` call -
|
153
153
|
# this gives us a chance to convert the data in the database back into our types.
|
154
|
+
#
|
155
|
+
# We're using the block form of `.attribute` to avoid loading the database schema just
|
156
|
+
# to figure out our wrapping type.
|
154
157
|
def wrap_store_column
|
155
158
|
return unless @model_class.respond_to?(:attribute_types)
|
156
159
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
160
|
+
store = self
|
161
|
+
|
162
|
+
@model_class.attribute(@column_name) do
|
163
|
+
original_type = @model_class.attribute_types.fetch(@column_name.to_s)
|
164
|
+
StoreColumnWrapper.new(original_type, store)
|
165
|
+
end
|
162
166
|
end
|
163
167
|
end
|
164
168
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serialize_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zaikio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|