Fix showing the query on the item search error page
Previously, the query wouldn't fill into the search box or page title if e.g. parsing had failed. Now it does! I'm not sure why the rescue strategy we previously had here doesn't work anymore (I'm sure it must've in the past sometime?), but this is simpler anyway, let's go!
This commit is contained in:
parent
bdefeb53d6
commit
1860f5b6be
1 changed files with 2 additions and 8 deletions
|
@ -130,6 +130,7 @@ class ItemsController < ApplicationController
|
|||
|
||||
def search_error(e)
|
||||
@items = []
|
||||
@query = params[:q]
|
||||
respond_to do |format|
|
||||
format.html { flash.now[:alert] = e.message; render }
|
||||
format.json { render :json => {error: e.message} }
|
||||
|
@ -139,14 +140,7 @@ class ItemsController < ApplicationController
|
|||
def set_query
|
||||
q = params[:q]
|
||||
if q.is_a?(String)
|
||||
begin
|
||||
@query = Item::Search::Query.from_text(q, current_user)
|
||||
rescue
|
||||
# Set the query string for error handling messages, but let the error
|
||||
# bubble up.
|
||||
@query = params[:q]
|
||||
raise
|
||||
end
|
||||
elsif q.is_a?(ActionController::Parameters)
|
||||
@query = Item::Search::Query.from_params(q, current_user)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue