title: How to render a PDF in the browser that is retrieve via rails controller
body: <p>I have a rails app that uses <a href="https://docs.recurly.com/" rel="noreferrer">Recurly</a>. I am attempting to download a PDF and render it in the browser. I currently have a link:</p>
  
  <pre><code>link_to 'Download', get_invoice_path(:number =&gt; invoice.invoice_number)
  </code></pre>
  
  <p>The associated controller has the <code>get_invoice</code> method that looks like so:</p>
  
  <pre><code>def get_invoice
      begin
        @pdf = Recurly::Invoice.find(params[:number], :format =&gt; 'pdf')
      rescue Recurly::Resource::NotFound =&gt; e
        flash[:error] = 'Invoice not found.'
      end
    end
  </code></pre>
  
  <p>When I click the link I get the PDF rendered in my console in binary form. How do I make this render the PDF in the browser? </p>