diff --git a/app/models/book.rb b/app/models/book.rb index 1e44ffe..11368a6 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -7,7 +7,7 @@ class Book include MemberHelper include Slug - field :book_title, as: :slug_title, type: String, localize: true + field :book_title, as: :slug_title, localize: true field :extracted_chapters, type: String, localize: true field :publisher, type: String, localize: true field :editor, type: String, localize: true @@ -73,7 +73,7 @@ class Book 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).count == 0 && datas.where(t.to_sym.ne => "").count == 0 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