From 88373ddf2086f39903b33202be7739242f7d914e Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 12 Nov 2019 18:29:37 +0100 Subject: [PATCH] individual: raise when the individual object cannot be created MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, a number of dossiers in production are for procedures for individuals, but don't have a `individual` object. This is probably because creating the Individual from France Connect infos fails – but fails quietly, and nullify the relationship. As a first step, we now raise an exception when the creation from FC infos fails. We will then identify the issue, and see if we can fix it – or if we should be resilient to this kind of issues. --- app/models/individual.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/individual.rb b/app/models/individual.rb index 32d2e0445..41a6f3963 100644 --- a/app/models/individual.rb +++ b/app/models/individual.rb @@ -10,7 +10,7 @@ class Individual < ApplicationRecord GENDER_FEMALE = 'Mme' def self.create_from_france_connect(fc_information) - create( + create!( nom: fc_information.family_name, prenom: fc_information.given_name, gender: fc_information.gender == 'female' ? GENDER_FEMALE : GENDER_MALE