property_sets 3.2.1 → 3.3.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ac3f25a9d664d3c11c22b27fcc295998bfa1ded
|
4
|
+
data.tar.gz: 6a46c42e0ec6ab7b07b750ea09660291c21a8735
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1eed5ef6c30432eedc454135c98463a3577f239c9f1b08de2af588133529eddf19c70e17625ca7091f8e1a5715069a52b4ef53eb4713bb6404a4aa2ee01bf72
|
7
|
+
data.tar.gz: 7e7d583269e88e7dd746f526bad20dfcbeec7c0af76cc9aa49d5e31692ceec41c4943a563e3bd08d2aad2c95b1a73088d691e63831d46b30e1b263d56675b4b6
|
@@ -85,7 +85,7 @@ module PropertySets
|
|
85
85
|
property_pairs.keys.each do |name|
|
86
86
|
record = lookup(name)
|
87
87
|
if with_protection && record.protected?
|
88
|
-
logger.warn("Someone tried to update the protected #{name} property to #{property_pairs[name]}")
|
88
|
+
association_class.logger.warn("Someone tried to update the protected #{name} property to #{property_pairs[name]}")
|
89
89
|
else
|
90
90
|
send("#{name}=", property_pairs[name])
|
91
91
|
end
|
@@ -113,7 +113,7 @@ module PropertySets
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def build_default(arg)
|
116
|
-
build(:name => arg.to_s, :value => raw_default(arg))
|
116
|
+
build(:name => arg.to_s, :value => association_class.raw_default(arg))
|
117
117
|
end
|
118
118
|
|
119
119
|
def lookup_without_default(arg)
|
@@ -127,7 +127,7 @@ module PropertySets
|
|
127
127
|
instance.value_serialized = serialized
|
128
128
|
PropertySets::Casting.read(type, instance.value)
|
129
129
|
else
|
130
|
-
value = default(key)
|
130
|
+
value = association_class.default(key)
|
131
131
|
if serialized
|
132
132
|
PropertySets::Casting.deserialize(value)
|
133
133
|
else
|
@@ -144,7 +144,7 @@ module PropertySets
|
|
144
144
|
|
145
145
|
owner = proxy_association.owner
|
146
146
|
|
147
|
-
instance.send("#{owner_class_sym}=", owner) if owner.new_record?
|
147
|
+
instance.send("#{association_class.owner_class_sym}=", owner) if owner.new_record?
|
148
148
|
instance
|
149
149
|
end
|
150
150
|
|
@@ -152,7 +152,7 @@ module PropertySets
|
|
152
152
|
# It does not have the side effect of adding a new setting object.
|
153
153
|
def lookup_or_default(arg)
|
154
154
|
instance = lookup_without_default(arg)
|
155
|
-
instance ||= association_class.new(:value => raw_default(arg))
|
155
|
+
instance ||= association_class.new(:value => association_class.raw_default(arg))
|
156
156
|
instance.value_serialized = property_serialized?(arg)
|
157
157
|
instance
|
158
158
|
end
|
@@ -27,14 +27,14 @@ module PropertySets
|
|
27
27
|
define_method("#{old_attr}=") { |value| send(setname).send("#{new_attr}=", value) }
|
28
28
|
|
29
29
|
define_method("#{old_attr}_changed?") do
|
30
|
-
|
31
|
-
return false unless
|
32
|
-
setting =
|
30
|
+
collection_proxy = send(setname)
|
31
|
+
return false unless collection_proxy.loaded?
|
32
|
+
setting = collection_proxy.lookup_without_default(new_attr)
|
33
33
|
|
34
34
|
if !setting
|
35
35
|
false # Nothing has been set which means that the attribute hasn't changed
|
36
36
|
elsif setting.new_record?
|
37
|
-
|
37
|
+
collection_proxy.association_class.default(new_attr) != setting.value
|
38
38
|
else
|
39
39
|
setting.value_changed?
|
40
40
|
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.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morten Primdahl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|