demarches-normaliennes/app/models/attestation.rb

15 lines
378 B
Ruby
Raw Normal View History

2017-06-02 14:30:26 +02:00
class Attestation < ApplicationRecord
belongs_to :dossier
mount_uploader :pdf, AttestationUploader
2019-07-31 16:09:28 +02:00
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
2017-06-02 14:30:26 +02:00
end