mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:01:42 +00:00
arreglos menores
This commit is contained in:
parent
c5cd07a82e
commit
2fb79ffa15
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue