properly handle search error in rails 3.0.5
This commit is contained in:
parent
9c0c7b78cf
commit
d335c2e677
1 changed files with 1 additions and 0 deletions
|
@ -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} }
|
||||||
|
|
Loading…
Reference in a new issue