demarches-normaliennes/app/models/attestation.rb

22 lines
468 B
Ruby
Raw Normal View History

2020-08-06 16:35:45 +02:00
# == Schema Information
#
# Table name: attestations
#
# id :integer not null, primary key
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# dossier_id :integer not null
#
2017-06-02 14:30:26 +02:00
class Attestation < ApplicationRecord
belongs_to :dossier, optional: false
2017-06-02 14:30:26 +02:00
2019-08-28 13:11:58 +02:00
has_one_attached :pdf
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)
2019-07-31 16:09:28 +02:00
end
end
2017-06-02 14:30:26 +02:00
end