fix(patron): dossier should have a procedure and champ should delegate to dossier
This commit is contained in:
parent
11b36b7fc2
commit
a90dada104
2 changed files with 3 additions and 1 deletions
|
@ -75,6 +75,7 @@ class RootController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
@dossier = Dossier.new(champs_public: all_champs)
|
@dossier = Dossier.new(champs_public: all_champs)
|
||||||
|
@dossier.association(:procedure).target = Procedure.new
|
||||||
all_champs.each do |champ|
|
all_champs.each do |champ|
|
||||||
champ.association(:dossier).target = @dossier
|
champ.association(:dossier).target = @dossier
|
||||||
champ.champs.each do |champ|
|
champ.champs.each do |champ|
|
||||||
|
|
|
@ -31,9 +31,10 @@ class Champ < ApplicationRecord
|
||||||
belongs_to :etablissement, optional: true, dependent: :destroy
|
belongs_to :etablissement, optional: true, dependent: :destroy
|
||||||
has_many :champs, -> { ordered }, foreign_key: :parent_id, inverse_of: :parent, dependent: :destroy
|
has_many :champs, -> { ordered }, foreign_key: :parent_id, inverse_of: :parent, dependent: :destroy
|
||||||
|
|
||||||
|
delegate :procedure, to: :dossier
|
||||||
|
|
||||||
delegate :libelle,
|
delegate :libelle,
|
||||||
:type_champ,
|
:type_champ,
|
||||||
:procedure,
|
|
||||||
:description,
|
:description,
|
||||||
:drop_down_list_options,
|
:drop_down_list_options,
|
||||||
:drop_down_other?,
|
:drop_down_other?,
|
||||||
|
|
Loading…
Reference in a new issue