From 4bc6962248533db84a69d579fb2d591bb418dd34 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 16:18:35 +0800 Subject: [PATCH] Update personal_books_controller.rb fix error --- app/controllers/personal_books_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/personal_books_controller.rb b/app/controllers/personal_books_controller.rb index 9125dbb..8e8925b 100644 --- a/app/controllers/personal_books_controller.rb +++ b/app/controllers/personal_books_controller.rb @@ -39,6 +39,8 @@ class PersonalBooksController < ApplicationController 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 "book_paper_type" + books_show = books_temp.select {|value| search_all_words((value.book_type.title rescue ""), params[:keywords])} when "language" books_show = books_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else @@ -71,6 +73,8 @@ class PersonalBooksController < ApplicationController t << {"value" => (book.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")} when "language" t << {"value" => (!book.language.nil? ? t("#{book.language}") : "")} + when "book_paper_type" + t << {"value" => (book.book_type.title rescue "")} else t << {"value" => (book.send(fs) rescue "")} end