I keep getting the DoubleRenderError and I cannot figure out why! Basically, I have an action that calls another action that checks a user inputted query for errors, and if theres an error, its stops and displays the error. But when i type in a query with an error, that when i get the double render! Any suggstions?
Heres the error checker action:
def if_user_formulated_request_properly
unless request.post?
flash[:error] = "This page can only be accessed through the search page. (POST request only)"
redirect_to(:action => "index") and return
end
if params[:query].blank?
flash[:error] = "Search criteria can not be blank"
redirect_to(:action => "index") and return
end
if !(params[:query] =~ /-/)
flash[:error] = "( Format of search criteria is wrong.<br /> Should be [IXLSpecClass value][year]-[Message ID] for exam
ple GP07-8)"
redirect_to(:action => "index") and return
end
if !(QueryParser.expression.match(params[:query]))
flash[:error] = %( Format of search criteria is wrong.<br />Should be [IXLSpecClass value][year]-[Message ID] for examp
le GP07-8)
redirect_to(:action => "index") and return
end
yield
And just in case you need the action calling this action..
def show
if_user_formulated_request_properly do
@statuses = IXLStatus.find(:all)
@input_messages = InputMessage.search_by(params[:query].stri
p) unless params[:query].blank?
@query = params[:query]
end
respond_to do |format|
format.html #default rendering
end
end
end
UPDATE
Also forgot to mention, this originally was a rails 2 app and was working, this error started when i upgraded to rails 3 (i believe), so maybe rails 3 does something different with and return
?