added better error messages for search errors

This commit is contained in:
albert
2012-01-13 18:21:16 -05:00
parent 67484e6c81
commit 28212516df
6 changed files with 15 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ class PostsController < ApplicationController
before_filter :member_only, :except => [:show, :index]
after_filter :save_recent_tags, :only => [:update]
respond_to :html, :xml, :json
rescue_from PostSets::SearchError, :with => :search_error
def index
@post_set = PostSets::Post.new(tag_query, params[:page])
@@ -38,6 +39,11 @@ class PostsController < ApplicationController
end
private
def search_error(exception)
@exception = exception
render :action => "error"
end
def tag_query
params[:tags] || (params[:post] && params[:post][:tags])
end