demarches-normaliennes/app/models/attestation.rb
2019-09-10 10:49:12 +02:00

16 lines
378 B
Ruby

class Attestation < ApplicationRecord
self.ignored_columns = ['pdf']
belongs_to :dossier
has_one_attached :pdf
has_one_attached :pdf_active_storage
def pdf_url
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)
end
end
end