From ad892f6e0f19fd14e45693cd17ce3d96faa1a38b Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 15 Aug 2019 10:48:15 +0800 Subject: [PATCH] Update personal_books_controller.rb --- app/controllers/personal_books_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/personal_books_controller.rb b/app/controllers/personal_books_controller.rb index 488d562..85288a2 100644 --- a/app/controllers/personal_books_controller.rb +++ b/app/controllers/personal_books_controller.rb @@ -40,7 +40,7 @@ class PersonalBooksController < ApplicationController books_show = books_temp.select {|value| search_all_words(value.create_link, params[:keywords])} end when "publish_date", "publication_date" - books_show = books_temp.select {|value| search_all_words(value.send(params[:selectbox]).strftime("%Y/%m/%d").to_s, params[:keywords])} + books_show = books_temp.select {|value| search_all_words((value.send(params[:selectbox]).strftime("%Y/%m/%d") rescue ""), params[:keywords])} when "author_type" books_show = books_temp.select {|value| search_all_words(value.book_author_types.collect{|bat| bat.title}.join(", "), params[:keywords])} when "language" @@ -70,7 +70,7 @@ class PersonalBooksController < ApplicationController t << {"value" => "#{book.create_link}"} end when "publish_date", "publication_date" - t << {"value" => (!book.send(fs).nil? ? book.send(fs).strftime('%Y/%m') : "")} + t << {"value" => (!book.send(fs).nil? ? book.send(fs).strftime('%Y/%m') : "" rescue "")} when "author_type" t << {"value" => (book.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")} when "language"