mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 16:56:21 +00:00
solo guardar el metadato cuando hubo cambios
This commit is contained in:
parent
a486502420
commit
a346254f19
6 changed files with 11 additions and 0 deletions
|
@ -40,6 +40,8 @@ class MetadataFile < MetadataTemplate
|
|||
|
||||
# Asociar la imagen subida al sitio y obtener la ruta
|
||||
def save
|
||||
return true unless changed?
|
||||
|
||||
value['description'] = sanitize value['description']
|
||||
value['path'] = nil unless path?
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ class MetadataGeo < MetadataTemplate
|
|||
end
|
||||
|
||||
def save
|
||||
return true unless changed?
|
||||
return true if empty?
|
||||
|
||||
self[:value] = value.transform_values(&:to_f)
|
||||
|
|
|
@ -52,6 +52,8 @@ class MetadataHasAndBelongsToMany < MetadataBelongsTo
|
|||
# Buscamos en belongs_to la relación local, si se eliminó hay que
|
||||
# quitarla de la relación remota, sino hay que agregarla.
|
||||
def save
|
||||
return true unless changed?
|
||||
|
||||
self[:value] = sanitize value
|
||||
|
||||
return true unless inverse? && !included?
|
||||
|
|
|
@ -38,6 +38,8 @@ class MetadataHasMany < MetadataRelatedPosts
|
|||
# Actualizar las relaciones inversas. Hay que buscar la diferencia
|
||||
# entre had y has_many.
|
||||
def save
|
||||
return true unless changed?
|
||||
|
||||
self[:value] = sanitize value
|
||||
|
||||
return true unless inverse?
|
||||
|
|
|
@ -8,6 +8,8 @@ class MetadataNumber < MetadataTemplate
|
|||
end
|
||||
|
||||
def save
|
||||
return true unless changed?
|
||||
|
||||
self[:value] = value.to_i
|
||||
self[:value] = encrypt(value) if private?
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ class MetadataOrder < MetadataTemplate
|
|||
end
|
||||
|
||||
def save
|
||||
return true unless changed?
|
||||
|
||||
self[:value] = value.to_i
|
||||
|
||||
true
|
||||
|
|
Loading…
Reference in a new issue