optimize templates api

This commit is contained in:
Pete Matsyburka
2024-02-24 19:00:23 +02:00
parent 02adbae758
commit b9a906b569
3 changed files with 57 additions and 19 deletions
-8
View File
@@ -8,14 +8,6 @@ ActiveSupport.on_load(:active_storage_attachment) do
def signed_uuid
@signed_uuid ||= ApplicationRecord.signed_id_verifier.generate(uuid, expires_in: 6.hours, purpose: :attachment)
end
def preview_image_url
first_page = preview_images.joins(:blob).find_by(blob: { filename: '0.jpg' })
return unless first_page
ActiveStorage::Blob.proxy_url(first_page.blob)
end
end
ActiveSupport.on_load(:active_storage_blob) do