Double Render Error

Hi,

I keep double render error after updating rails. Heres my code, any suggestions?

def show         if_user_formulated_request_properly do         @input_messages = InputMessage.search_by(params[:query].strip) unless params[:query].blank?         end         respond_to do |format|           format.html #default rendering         end         end   end

  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 example 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 example GP07-8)

redirect_to(:action => "index") and return   end yield

add respond_to :html

to your controller and change respond_to do |format|   format.htm ... end

to respond_with(@input_messages)

.. tom

ps: or add 'return' to your condition if condition has been met (eg in show method)

Who wrote that code?