property_sets 3.5.1 → 3.5.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5b1904f990b0edf7d1a91f1ac6b703f9bddc428d280e031ae4daaa6983f6835
|
4
|
+
data.tar.gz: cea92b99f11a508d543d9ff4f812e9326ae30aefa06e448619b19ab6dc1dbe02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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}=")
|
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)
|
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.
|
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-
|
11
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|