demarches-normaliennes/app/models/attestation.rb

17 lines
378 B
Ruby
Raw Normal View History

2017-06-02 14:30:26 +02:00
class Attestation < ApplicationRecord
2019-08-28 16:14:20 +02:00
self.ignored_columns = ['pdf']
2017-06-02 14:30:26 +02:00
belongs_to :dossier
2019-08-28 13:11:58 +02:00
has_one_attached :pdf
has_one_attached :pdf_active_storage
2019-07-31 16:09:28 +02:00
def pdf_url
2019-08-28 13:11:58 +02:00
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)
2019-07-31 16:09:28 +02:00
end
end
2017-06-02 14:30:26 +02:00
end