title: How to render erb template to string inside action?
body: <p>I need a string of html (something like <code>"&lt;html&gt;&lt;body&gt;Hello World&lt;/body&gt;&lt;/html&gt;"</code>) for faxing purpose. </p>
  
  <p>I wrote it into a seprate erb file: <code>views/orders/_fax.html.erb</code> ,
  and try to render the erb in action: <code>html_data = render(:partial =&gt; 'fax')</code>. </p>
  
  <p>Here is part of the controller that raises the issue:</p>
  
  <pre><code>  respond_to do |format|
        if @order.save   
          html_data = render(:partial =&gt; '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
  </code></pre>
  
  <p>It gave me an AbstractController::DoubleRenderError as below:</p>
  
  <pre><code>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".
  </code></pre>
  
  <p>How to solve this problem?</p>