individual: raise when the individual object cannot be created

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.
This commit is contained in:
Pierre de La Morinerie 2019-11-12 18:29:37 +01:00
parent d86e2bfbc5
commit 88373ddf20

View file

@ -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