5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-02 07:54:15 +00:00

informar cuando el nombre de archivo está vacío

This commit is contained in:
f 2022-07-13 13:34:45 -03:00
parent cd523babad
commit aab8ed9fed

View file

@ -67,7 +67,9 @@ module ActiveStorage
# @param :key [String]
# @return [String]
def filename_for(key)
ActiveStorage::Blob.where(key: key).limit(1).pluck(:filename).first
ActiveStorage::Blob.where(key: key).limit(1).pluck(:filename).first.tap do |filename|
raise ArgumentError, "Filename for key #{key} is blank" if filename.blank?
end
end
# Crea una ruta para la llave con un nombre conocido.