Remove carrierwave uploaders

This commit is contained in:
Paul Chavard 2019-08-28 13:11:58 +02:00
parent 9bfa34f985
commit 7ffb98e616
30 changed files with 89 additions and 759 deletions

View file

@ -1,18 +1,14 @@
class Attestation < ApplicationRecord
belongs_to :dossier
mount_uploader :pdf, AttestationUploader
has_one_attached :pdf
has_one_attached :pdf_active_storage
def pdf_url
if pdf_active_storage.attached?
if pdf.attached?
Rails.application.routes.url_helpers.url_for(pdf)
elsif 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
File.join(LOCAL_DOWNLOAD_URL, pdf.url)
end
end
end