1
0
Fork 0
forked from OpenNeo/impress

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] } format.js { render :json => {:items => @items, :total_pages => @items.total_pages}, :callback => params[:callback] }
end end
rescue Item::SearchError rescue Item::SearchError
@items = []
respond_to do |format| respond_to do |format|
format.html { flash.now[:alert] = $!.message } format.html { flash.now[:alert] = $!.message }
format.json { render :json => {:error => $!.message} } format.json { render :json => {:error => $!.message} }