diff --git a/app/models/metadata_file.rb b/app/models/metadata_file.rb index f976a9d..cf5f8dc 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