mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-28 21:16:22 +00:00
asegurar que haya una conexion disponible
This commit is contained in:
parent
250468657f
commit
ef416174f7
1 changed files with 7 additions and 5 deletions
|
@ -71,11 +71,13 @@ class MetadataImage < MetadataTemplate
|
||||||
#
|
#
|
||||||
# @return ActiveStorage::Attachment
|
# @return ActiveStorage::Attachment
|
||||||
def static_file
|
def static_file
|
||||||
if uploaded?
|
ActiveRecord::Base.connection_pool.with_connection do
|
||||||
blob = ActiveStorage::Blob.find_by(key: key_from_path)
|
if uploaded?
|
||||||
@static_file ||= site.static_files.find_by(blob_id: blob.id)
|
blob = ActiveStorage::Blob.find_by(key: key_from_path)
|
||||||
elsif site.static_files.attach(value['path'])
|
@static_file ||= site.static_files.find_by(blob_id: blob.id)
|
||||||
@static_file ||= site.static_files.last
|
elsif site.static_files.attach(value['path'])
|
||||||
|
@static_file ||= site.static_files.last
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue