From 293468a6f1e3b030937c4a73076d5c3c5ff5a21f Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 16 Mar 2016 08:05:03 +0100 Subject: [PATCH] Ignore empty relations. --- app/models/application_model.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/application_model.rb b/app/models/application_model.rb index eefa7ef27..28e0c17a8 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -92,7 +92,7 @@ returns =begin -set rellations of model based on params +set relations of model based on params model = Model.find(1) result = model.param_set_associations(params) @@ -117,6 +117,7 @@ returns end list = [] list_of_items.each {|item| + next if !item list.push(assoc.klass.find(item)) } send(assoc.name.to_s + '=', list)