dossiers: add a validation on dossier individual
Validate that a dossier on a `for_individual?` procedure always has an `individual` associated record. For this, the individual needs to be built before the record is validated (i.e. even before the `before_create` callback is run). This should help with #4596: now if a dossier is created without an `individual`, or if the `invividual` record is later removed, the validation will fail.
This commit is contained in:
parent
e32a42cfe6
commit
5e05556ee8
4 changed files with 45 additions and 66 deletions
|
@ -9,8 +9,8 @@ class Individual < ApplicationRecord
|
|||
GENDER_MALE = 'M.'
|
||||
GENDER_FEMALE = 'Mme'
|
||||
|
||||
def self.create_from_france_connect(fc_information)
|
||||
create!(
|
||||
def self.from_france_connect(fc_information)
|
||||
new(
|
||||
nom: fc_information.family_name,
|
||||
prenom: fc_information.given_name,
|
||||
gender: fc_information.gender == 'female' ? GENDER_FEMALE : GENDER_MALE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue