fix(patron): dossier should have a procedure and champ should delegate to dossier

This commit is contained in:
Paul Chavard 2022-11-30 10:53:51 +01:00
parent 11b36b7fc2
commit a90dada104
2 changed files with 3 additions and 1 deletions

View file

@ -75,6 +75,7 @@ class RootController < ApplicationController
end
@dossier = Dossier.new(champs_public: all_champs)
@dossier.association(:procedure).target = Procedure.new
all_champs.each do |champ|
champ.association(:dossier).target = @dossier
champ.champs.each do |champ|

View file

@ -31,9 +31,10 @@ class Champ < ApplicationRecord
belongs_to :etablissement, optional: true, dependent: :destroy
has_many :champs, -> { ordered }, foreign_key: :parent_id, inverse_of: :parent, dependent: :destroy
delegate :procedure, to: :dossier
delegate :libelle,
:type_champ,
:procedure,
:description,
:drop_down_list_options,
:drop_down_other?,