From d004d722ca7ad3cca579b1214c7b5550a65ee806 Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 15 Aug 2019 09:59:22 +0800 Subject: [PATCH] Update personal_books_controller.rb fix error --- app/controllers/personal_books_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/personal_books_controller.rb b/app/controllers/personal_books_controller.rb index f420f3f..8f72c34 100644 --- a/app/controllers/personal_books_controller.rb +++ b/app/controllers/personal_books_controller.rb @@ -29,8 +29,13 @@ class PersonalBooksController < ApplicationController books_temp = Book.where(:is_hidden=>false).sort_by{ |tp| [-tp[:year].to_i,-tp[:publication_date].to_i] } case params[:selectbox] when "book_title", "extracted_chapters", "default" + if params[:selectbox]=="dafault" + search_temp="book_title" + else + search_temp=params[:selectbox] + end if page.custom_string_field == "table" - books_show = books_temp.select {|value| search_all_words(value.send(params[:selectbox]), params[:keywords])} + books_show = books_temp.select {|value| search_all_words(value.send(search_temp), params[:keywords])} else books_show = books_temp.select {|value| search_all_words(value.create_link, params[:keywords])} end