From 44ed0018a8b8ab3f7c43d625a62018448cb5c000 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 14 Aug 2019 15:29:35 +0800 Subject: [PATCH] Update personal_books_controller.rb --- app/controllers/personal_books_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/personal_books_controller.rb b/app/controllers/personal_books_controller.rb index 94103f4..5204b63 100644 --- a/app/controllers/personal_books_controller.rb +++ b/app/controllers/personal_books_controller.rb @@ -37,7 +37,7 @@ class PersonalBooksController < ApplicationController when "author_type" books_show = books_temp.select {|value| value.book_author_types.collect{|bat| bat.title}.join(", ").include? params[:keywords]} when "language" - books_show = books_temp.select {|value| (!value.language.nil? ? I18n.t("personal_book.#{value.language}") : "").include? params[:keywords]} + books_show = books_temp.select {|value| (!value.language.nil? ? t("#{value.language}") : "").include? params[:keywords]} else books_show = books_temp.select {|value| value.send(params[:selectbox]).to_s.include? params[:keywords]} end @@ -64,11 +64,11 @@ class PersonalBooksController < ApplicationController t << {"value" => "#{book.create_link}"} end when "publish_date", "publication_date" - t << {"value" => "book.publication_date.strftime('%Y/%m/%d')"} + t << {"value" => (!book.publication_date.nil? ? book.publication_date.strftime('%Y/%m/%d') : "")} when "author_type" t << {"value" => (book.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")} when "language" - t << {"value" => (!book.language.nil? ? t("#{book.language}") : "" rescue "")} + t << {"value" => (!book.language.nil? ? t("#{book.language}") : "")} else t << {"value" => book.send(fs)} end