property_sets 3.5.1 → 3.5.3

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: 86b08edc1a23424fd3989657070dcac3482dbc8ade56a6a08b36c06c99a55582
4
- data.tar.gz: b43f0741456a6d62c670110a47e052680d5edc188af2d81175eb7beb3e85e2ff
3
+ metadata.gz: e5b1904f990b0edf7d1a91f1ac6b703f9bddc428d280e031ae4daaa6983f6835
4
+ data.tar.gz: cea92b99f11a508d543d9ff4f812e9326ae30aefa06e448619b19ab6dc1dbe02
5
5
  SHA512:
6
- metadata.gz: 8ac2a0df812e4e43ea688c5997dacc73cb02e2abf10274e2f4c170b32fa0a53ccd36594f1e34fff4154723b4a8e31c5c7701e3a5c59e838b8496dc8a39489f11
7
- data.tar.gz: 74c4b2bc22b462723ade10c4886b85e188ae06c33ea8605b8f12d0b95f22e684672a2e1e3e6b5884345d75d029ab044df4ccae744ea08119e535940ec9b9d17c
6
+ metadata.gz: bc1e1b4afd64f05275f2123fb05e9614009eb3ecfb4e8d4940fc74811300a15c2cd7dc13db75ec9d5883d66f81aa2ec4ae637e7039f10ffedbadcb198190c499
7
+ data.tar.gz: 976d4c41225d97445c1c9ebf78b19d55d97465c1dce1731fb648d81b1d4e9a35b3446cbfb2e3a5491a6e63c3a1b7172c92533303cc239853c409cb558f951323
@@ -163,15 +163,17 @@ module PropertySets
163
163
  end
164
164
 
165
165
  module InstanceMethods
166
- def update_attributes(attributes)
166
+ def update(attributes)
167
167
  update_property_set_attributes(attributes)
168
168
  super
169
169
  end
170
+ alias update_attributes update
170
171
 
171
- def update_attributes!(attributes)
172
+ def update!(attributes)
172
173
  update_property_set_attributes(attributes)
173
174
  super
174
175
  end
176
+ alias update_attributes! update!
175
177
 
176
178
  def update_property_set_attributes(attributes)
177
179
  if attributes && self.class.property_set_index.any?
@@ -21,10 +21,18 @@ module PropertySets
21
21
  raise "Second argument must be a Hash" unless mappings.is_a?(Hash)
22
22
 
23
23
  mappings.each do |old_attr, new_attr|
24
+ if ActiveRecord.version < Gem::Version.new("5.0")
25
+ attribute old_attr, ActiveRecord::Type::Value.new
26
+ else
27
+ attribute old_attr, ActiveModel::Type::Value.new
28
+ end
24
29
  define_method(old_attr) { send(setname).send(new_attr) }
25
30
  alias_method "#{old_attr}_before_type_cast", old_attr
26
31
  define_method("#{old_attr}?") { send(setname).send("#{new_attr}?") }
27
- define_method("#{old_attr}=") { |value| send(setname).send("#{new_attr}=", value) }
32
+ define_method("#{old_attr}=") do |value|
33
+ send(setname).send("#{new_attr}=", value)
34
+ super(value)
35
+ end
28
36
 
29
37
  define_method("#{old_attr}_changed?") do
30
38
  collection_proxy = send(setname)
@@ -1,3 +1,3 @@
1
1
  module PropertySets
2
- VERSION = "3.5.1"
2
+ VERSION = "3.5.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: property_sets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Primdahl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-25 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord