From f95e33e5d6846b28c3f871bc6f645e7ad6564aed Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 13 Jan 2016 18:46:02 +0800 Subject: [PATCH] field object type --- app/models/project.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index 5031f77..2a39ad0 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -57,7 +57,11 @@ class Project 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_project.#{t}") } if !fields_to_remove.include?(t)