Update personal_books_controller.rb

fix error
This commit is contained in:
chiu 2019-08-19 16:18:35 +08:00
parent 7c338ff4bc
commit 4bc6962248
1 changed files with 4 additions and 0 deletions

View File

@ -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