Migrate attestation files to active_storage
This commit is contained in:
parent
a194ffa392
commit
a19b10b118
11 changed files with 289 additions and 96 deletions
|
@ -3,8 +3,12 @@ class Attestation < ApplicationRecord
|
|||
|
||||
mount_uploader :pdf, AttestationUploader
|
||||
|
||||
has_one_attached :pdf_active_storage
|
||||
|
||||
def pdf_url
|
||||
if Rails.application.secrets.fog[:enabled]
|
||||
if pdf_active_storage.attached?
|
||||
Rails.application.routes.url_helpers.url_for(pdf_active_storage)
|
||||
elsif Rails.application.secrets.fog[:enabled]
|
||||
RemoteDownloader.new(pdf.path).url
|
||||
elsif pdf&.url
|
||||
# FIXME: this is horrible but used only in dev and will be removed after migration
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue