From 3a38cae0bcf7cb0b448e5ea273a3b5ae463d5b67 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 24 Feb 2021 13:04:46 -0300 Subject: [PATCH] no ejecutar validaciones al guardar un archivo --- app/models/metadata_file.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/metadata_file.rb b/app/models/metadata_file.rb index f976a9d6..cf5f8dcc 100644 --- a/app/models/metadata_file.rb +++ b/app/models/metadata_file.rb @@ -47,13 +47,13 @@ class MetadataFile < MetadataTemplate # repetida. def save value['description'] = sanitize value['description'] - value['path'] = nil unless path? - return true if path_optional? - return false unless hardlink - - # Modificar el valor actual - value['path'] = relative_destination_path + if path? + hardlink + value['path'] = relative_destination_path + else + value['path'] = nil + end true end @@ -107,6 +107,8 @@ class MetadataFile < MetadataTemplate end def file + return unless path? + @file ||= case value['path'] when ActionDispatch::Http::UploadedFile then value['path'].tempfile.path