5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 02:01:42 +00:00

no cambiar el valor a true de los checkboxes closes #153

This commit is contained in:
f 2020-05-26 16:36:26 -03:00
parent 74245679fd
commit 96ddc47b77

View file

@ -14,15 +14,18 @@ class MetadataBoolean < MetadataTemplate
#
# En este caso, queremos priorizar el dato enviado por le usuarie
# antes que el generado internamente.
#
# Tenemos varios casos:
#
# * nil => false
# * '0' => false
# * '1' => true
# * false
# * true
def value
return false if self[:value] == '0'
return self[:value] unless self[:value].nil?
return document.data.fetch(name.to_s, default_value) if self[:value].nil?
return self[:value] unless self[:value].is_a? String
document.data.fetch(name.to_s, default_value)
end
def save
self[:value] = !%w[0 false].include?(self[:value])
true
self[:value] = self[:value] == '1'
end
end