From 0a8ac645d8b5b915bc55f29cfb17cbfb3bbfbdfb Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 29 Aug 2017 12:20:58 +0200 Subject: [PATCH] Shave some requests in build_default_champs --- app/models/dossier.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 653a7d718..a8813e5aa 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -101,12 +101,12 @@ class Dossier < ActiveRecord::Base end def build_default_champs - procedure.types_de_champ.each do |type_de_champ| - ChampPublic.create(type_de_champ_id: type_de_champ.id, dossier_id: id) + procedure.types_de_champ.all.each do |type_de_champ| + ChampPublic.create(type_de_champ: type_de_champ, dossier: self) end - procedure.types_de_champ_private.each do |type_de_champ| - ChampPrivate.create(type_de_champ_id: type_de_champ.id, dossier_id: id) + procedure.types_de_champ_private.all.each do |type_de_champ| + ChampPrivate.create(type_de_champ: type_de_champ, dossier: self) end end