demarches-normaliennes/app/models/attestation.rb
2019-07-31 18:30:40 +02:00

14 lines
378 B
Ruby

class Attestation < ApplicationRecord
belongs_to :dossier
mount_uploader :pdf, AttestationUploader
def pdf_url
if 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