mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 14:31:42 +00:00
al migrar un archivo reutilizar la key
This commit is contained in:
parent
c5896a63cf
commit
ecb823f407
1 changed files with 3 additions and 1 deletions
|
@ -78,7 +78,9 @@ class MetadataFile < MetadataTemplate
|
||||||
if (blob_id = ActiveStorage::Blob.where(key: key_from_path).pluck(:id).first)
|
if (blob_id = ActiveStorage::Blob.where(key: key_from_path).pluck(:id).first)
|
||||||
site.static_files.find_by(blob_id: blob_id)
|
site.static_files.find_by(blob_id: blob_id)
|
||||||
elsif path? && pathname.exist? && site.static_files.attach(io: pathname.open, filename: pathname.basename)
|
elsif path? && pathname.exist? && site.static_files.attach(io: pathname.open, filename: pathname.basename)
|
||||||
site.static_files.last
|
site.static_files.last.tap do |s|
|
||||||
|
s.blob.update(key: key_from_path)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue