Merge pull request #3718 from betagouv/fix_siret_champ
Champ Siret: Fix siret-champ save
This commit is contained in:
commit
9a824b0460
2 changed files with 4 additions and 4 deletions
|
@ -13,9 +13,9 @@ class Champs::SiretController < ApplicationController
|
|||
etablissement = find_etablisement_with_siret
|
||||
if etablissement.present?
|
||||
@etablissement = etablissement
|
||||
if @champ.present?
|
||||
etablissement.champ = @champ
|
||||
etablissement.save!
|
||||
|
||||
if !@champ.nil?
|
||||
@champ.update!(value: etablissement.siret, etablissement: etablissement)
|
||||
end
|
||||
else
|
||||
@champ&.update!(value: '')
|
||||
|
|
|
@ -6,7 +6,7 @@ describe Champs::SiretController, type: :controller do
|
|||
|
||||
describe '#show' do
|
||||
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
|
||||
let(:champ) { create(:champ_siret, dossier: dossier) }
|
||||
let(:champ) { create(:champ_siret, dossier: dossier, value: nil, etablissement: nil) }
|
||||
let(:params) do
|
||||
{
|
||||
champ_id: champ.id,
|
||||
|
|
Loading…
Reference in a new issue