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:
parent
11660bc688
commit
0e010e804c
1 changed files with 1 additions and 9 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue