我编写了一个简单的小函数,它每 60 秒刷新一次页面,用于“Time.now.strftime”函数。但是,当我执行搜索并最终使用搜索结果刷新页面时,我收到以下错误,我无法弄清楚:
无法将 nil 转换为字符串
app/models/product.rb:37:in `+'
app/models/product.rb:37:in `fuzzy_search'
app/controllers/products_controller.rb:92:in `search'
def self.fuzzy_search(search_string)
(LINE 37) search_string = "%" + search_string + "%"
self.find(:all, :conditions => ["title LIKE ?", search_string])
end
(LINE 92) @products = Product.fuzzy_search(params[:search_string])
if @products.empty?
flash.now[:alert] = "No records found - displaying all records..."
@products = Product.find :all, :order => 'title'
end
render :action => "index"
任何帮助将不胜感激谢谢