foobara 0.0.22 → 0.0.23
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/CHANGELOG.md +2 -1
- data/projects/model/src/model.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17aca0016743da17a419540e3953855d94ee622a0f331fdc1e3765f02eef8772
|
4
|
+
data.tar.gz: f35365045973554ca57d08107dcb645f26406cd70e69598120f234462257074b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cad819d5b7aeb1122a31a36f8ba4569d0142454be39030629d8996f60469edc6da2d555ae49c0b8513c011ad0e317de2a6696fee1de807c5c813a19a8b2f07c
|
7
|
+
data.tar.gz: ab20a3c72ffa7d0ebb3e921d70bf519d4070ab076ae699743c4600b7e17e9cd1f08d0437dc27a39f141272c6a3d7e0bad824a9cda05f07a3c17b6ff7bdb1d55c
|
data/CHANGELOG.md
CHANGED
data/projects/model/src/model.rb
CHANGED
@@ -207,8 +207,14 @@ module Foobara
|
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
|
-
|
211
|
-
|
210
|
+
mutable = if options.key?(:mutable)
|
211
|
+
options[:mutable]
|
212
|
+
elsif self.class.model_type.declaration_data.key?(:mutable)
|
213
|
+
self.class.model_type.declaration_data[:mutable]
|
214
|
+
else
|
215
|
+
# why do we default to true here but false in the transformers?
|
216
|
+
true
|
217
|
+
end
|
212
218
|
|
213
219
|
self.mutable = if mutable.is_a?(::Array)
|
214
220
|
mutable.map(&:to_sym)
|
@@ -228,7 +234,7 @@ module Foobara
|
|
228
234
|
def write_attribute(attribute_name, value)
|
229
235
|
attribute_name = attribute_name.to_sym
|
230
236
|
|
231
|
-
if mutable == true || mutable&.include?(attribute_name)
|
237
|
+
if mutable == true || (mutable != false && mutable&.include?(attribute_name))
|
232
238
|
outcome = cast_attribute(attribute_name, value)
|
233
239
|
attributes[attribute_name] = outcome.success? ? outcome.result : value
|
234
240
|
else
|