From 3fc847694784fb43d7a8f88901fe4091c4ea9011 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 27 Feb 2018 11:00:34 +0100 Subject: [PATCH] some old champ live in a parallel space time continuum without valid dossier or type_de_champ --- lib/tasks/2018_02_13_fill_champ_private_and_type.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/2018_02_13_fill_champ_private_and_type.rake b/lib/tasks/2018_02_13_fill_champ_private_and_type.rake index 86a2da1ec..056d9bf87 100644 --- a/lib/tasks/2018_02_13_fill_champ_private_and_type.rake +++ b/lib/tasks/2018_02_13_fill_champ_private_and_type.rake @@ -1,7 +1,9 @@ namespace :'2018_02_13_fill_champ_private_and_type' do task set: :environment do Champ.includes(:type_de_champ).find_each do |champ| - champ.update_columns(champ.type_de_champ.params_for_champ) + if champ.type_de_champ.present? + champ.update_columns(champ.type_de_champ.params_for_champ) + end end TypeDeChamp.find_each do |type_de_champ|