serialize_attributes 0.3.0 → 0.3.1

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: 28fc6ce168d3889baa7be09c4e1a18c794ffda743d8966ba3b763b50c35e96c0
4
- data.tar.gz: cc7f1eb8f24138ecd4eaa12e8253d192ae3e35bb6b83c63c791490b9fc544202
3
+ metadata.gz: 4c06deef436a52e15560111b4055b706d769d684106edaa4d224a7121367cfde
4
+ data.tar.gz: e8bf6db9353e825f8df2cae7f79634c39826c69793a91a8dd3dba60a71c6039d
5
5
  SHA512:
6
- metadata.gz: 755dc02f7b3483632cbbbfc13f0f5faec360729015f2aa07a6bb707e3cee7ecc2f018f69da71b5230bea70cbee75993e11dd8cf625d532372ceb119aed2a115e
7
- data.tar.gz: d20e235ed061cf26773ba03fe047e692ab7c57e03d68742beb30c48d9d533c70be8b4fd84a913ee95a37329b2cc2cf8ac6fc817c0a06643131d22a7bbed4bccb
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
- original_store_column_type = @model_class.attribute_types.fetch(@column_name.to_s)
158
- @model_class.attribute(@column_name, StoreColumnWrapper.new(
159
- original_store_column_type,
160
- self
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SerializeAttributes
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  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.0
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-14 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel