diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index a5ed53056..a0e6aca7f 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -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| diff --git a/app/models/champ.rb b/app/models/champ.rb index 3918411bf..8852b85c5 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -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?,