¿Cómo renderizar la plantilla erb a la cadena dentro de la acción?

Necesito una cadena de html (algo así como"<html><body>Hello World</body></html>") para fines de fax.

Lo escribí en un archivo erb seprate:views/orders/_fax.html.erb , e intenta renderizar el erb en acción:html_data = render(:partial => 'fax').

Aquí es parte del controlador que plantea el problema:

  respond_to do |format|
      if @order.save   
        html_data = render(:partial => 'fax')
        response = fax_machine.send_fax(html_data)
        ......

        format.html { redirect_to @order, notice: 'Order was successfully created.' }
        format.json { render json: @order, status: :created, location: @order }
      else  
        format.html { render action: "new" }
        format.json { render json: @order.errors, status: :unprocessable_entity }
      end
    end

Me dio un AbstractController :: DoubleRenderError de la siguiente manera:

AbstractController::DoubleRenderError in OrdersController#create

Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".

¿Cómo resolver este problema?

Respuestas a la pregunta(4)

Su respuesta a la pregunta