From d335c2e6775ba50cdb623ebe7c9b1f0890e7f0b3 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 13 Jan 2012 15:10:25 -0600 Subject: [PATCH] properly handle search error in rails 3.0.5 --- app/controllers/items_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index f90e1240..832353f9 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -18,6 +18,7 @@ class ItemsController < ApplicationController format.js { render :json => {:items => @items, :total_pages => @items.total_pages}, :callback => params[:callback] } end rescue Item::SearchError + @items = [] respond_to do |format| format.html { flash.now[:alert] = $!.message } format.json { render :json => {:error => $!.message} }