small fix

This commit is contained in:
Harry Bomrah 2016-02-15 19:06:48 +08:00
parent 3dfbff9dd7
commit 4f480077b2
1 changed files with 15 additions and 4 deletions

View File

@ -67,11 +67,22 @@ class Book
"book_title"
]
pd_title = fields_to_show.collect do |t|
{
"plugin_data_title" => I18n.t("personal_book.#{t}")
}
fields_to_remove = []
pd_title = []
fields_to_show.each do |t|
if (self.fields[t].type.to_s == "String" rescue false)
fields_to_remove << t if (datas.where(t.to_sym.ne => nil).or(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_book.#{t}")
} if !fields_to_remove.include?(t)
end
fields_to_show = fields_to_show - fields_to_remove
plugin_datas = datas.sort_for_frontend.collect do |p|