introduce constants for M./Mme
This commit is contained in:
parent
d7105cb6f8
commit
1e6847bc6f
2 changed files with 12 additions and 5 deletions
|
@ -478,11 +478,7 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
|
||||
def update_with_france_connect(fc_information)
|
||||
self.individual = Individual.create(
|
||||
nom: fc_information.family_name,
|
||||
prenom: fc_information.given_name,
|
||||
gender: fc_information.gender == 'female' ? 'Mme' : 'M.'
|
||||
)
|
||||
self.individual = Individual.create_from_france_connect(fc_information)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -5,4 +5,15 @@ class Individual < ApplicationRecord
|
|||
validates :gender, presence: true, allow_nil: false, on: :update
|
||||
validates :nom, presence: true, allow_blank: false, allow_nil: false, on: :update
|
||||
validates :prenom, presence: true, allow_blank: false, allow_nil: false, on: :update
|
||||
|
||||
GENDER_MALE = 'M.'
|
||||
GENDER_FEMALE = 'Mme'
|
||||
|
||||
def self.create_from_france_connect(fc_information)
|
||||
create(
|
||||
nom: fc_information.family_name,
|
||||
prenom: fc_information.given_name,
|
||||
gender: fc_information.gender == 'female' ? GENDER_FEMALE : GENDER_MALE
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue