From 8f92bb92baca4bf6bb0fb9f204270f0f252dd474 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 13 Jan 2016 18:49:49 +0800 Subject: [PATCH] field object type --- app/models/research.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/research.rb b/app/models/research.rb index b502fc9..19add74 100644 --- a/app/models/research.rb +++ b/app/models/research.rb @@ -57,7 +57,11 @@ class Research pd_title = [] fields_to_show.each do |t| - fields_to_remove << t if (datas.where(t.to_sym.ne => nil, t.to_sym.ne => "").count == 0 rescue false) + if (self.fields[t].type.to_s == "String" || self.fields[t].type.to_s == "Object" rescue false) + fields_to_remove << t if (datas.where(t.to_sym.ne => nil, t.to_sym.ne => "").count == 0 rescue false) + else + fields_to_remove << t if (datas.where(t.to_sym.ne => nil).count == 0 rescue false) + end pd_title << { "plugin_data_title" => I18n.t("personal_research.#{t}") } if !fields_to_remove.include?(t)