properly handle search error in rails 3.0.5

This commit is contained in:
Emi Matchu 2012-01-13 15:10:25 -06:00
parent 9c0c7b78cf
commit d335c2e677

View file

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