From 1ea4c2aa367716c626f36665f6058196b5557511 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 20 Jul 2020 16:28:51 +0200 Subject: [PATCH] models: require belong_to associations on attestation --- app/models/attestation.rb | 2 +- spec/factories/attestation.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/attestation.rb b/app/models/attestation.rb index c8efecb07..9964a5f7a 100644 --- a/app/models/attestation.rb +++ b/app/models/attestation.rb @@ -9,7 +9,7 @@ # dossier_id :integer not null # class Attestation < ApplicationRecord - belongs_to :dossier + belongs_to :dossier, optional: false has_one_attached :pdf diff --git a/spec/factories/attestation.rb b/spec/factories/attestation.rb index dc92a6661..e46f9a592 100644 --- a/spec/factories/attestation.rb +++ b/spec/factories/attestation.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :attestation do title { 'title' } - dossier { create(:dossier) } + association :dossier end trait :with_pdf do