Mark 1to1 nested relationships as update_only
to avoid creating multiple associations
This fixes the invalid entreprises without etablissements
This commit is contained in:
parent
d14c67c32b
commit
d5f620a163
2 changed files with 2 additions and 2 deletions
|
@ -6,7 +6,7 @@ class Entreprise < ApplicationRecord
|
||||||
validates :siren, presence: true
|
validates :siren, presence: true
|
||||||
validates :dossier_id, uniqueness: true
|
validates :dossier_id, uniqueness: true
|
||||||
|
|
||||||
accepts_nested_attributes_for :rna_information
|
accepts_nested_attributes_for :rna_information, update_only: true
|
||||||
|
|
||||||
before_save :default_values
|
before_save :default_values
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Etablissement < ApplicationRecord
|
||||||
has_many :exercices, dependent: :destroy
|
has_many :exercices, dependent: :destroy
|
||||||
|
|
||||||
accepts_nested_attributes_for :exercices
|
accepts_nested_attributes_for :exercices
|
||||||
accepts_nested_attributes_for :entreprise
|
accepts_nested_attributes_for :entreprise, update_only: true
|
||||||
|
|
||||||
validates :dossier_id, uniqueness: true
|
validates :dossier_id, uniqueness: true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue