2017-06-02 14:30:26 +02:00
|
|
|
class Attestation < ApplicationRecord
|
2019-09-17 10:16:52 +02:00
|
|
|
self.ignored_columns = ['pdf', 'content_secure_token']
|
2019-08-28 16:14:20 +02:00
|
|
|
|
2017-06-02 14:30:26 +02:00
|
|
|
belongs_to :dossier
|
|
|
|
|
2019-08-28 13:11:58 +02:00
|
|
|
has_one_attached :pdf
|
2019-08-27 17:42:52 +02:00
|
|
|
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?
|
2019-08-27 17:42:52 +02:00
|
|
|
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
|