5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 17:46:21 +00:00

fix: el valor original viene del documento y se cambia una sola vez

This commit is contained in:
f 2024-04-17 17:58:14 -03:00
parent 11660bc688
commit 0e010e804c
No known key found for this signature in database

View file

@ -38,18 +38,10 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
"#{cache_key}-#{cache_version}"
end
# XXX: Deberíamos sanitizar durante la asignación?
def value=(new_value)
@value_was = value
self[:value] = new_value
end
# Siempre obtener el valor actual y solo obtenerlo del documento una
# vez.
def value_was
return @value_was if instance_variable_defined? '@value_was'
@value_was = document_value
@value_was ||= document_value.nil? ? default_value : document_value
end
def changed?