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

arreglos menores

This commit is contained in:
f 2021-02-11 16:45:03 -03:00
parent c5cd07a82e
commit 2fb79ffa15

View file

@ -23,6 +23,7 @@ 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
@ -122,6 +123,8 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
# En caso de que algún campo necesite realizar acciones antes de ser
# guardado
def save
return true unless changed?
self[:value] = sanitize value
self[:value] = encrypt(value) if private?
@ -138,7 +141,7 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
# Determina si el campo es privado y debería ser cifrado
def private?
!!layout.metadata.dig(name, 'private')
layout.metadata.dig(name, 'private').present?
end
private