title: Rails 4 - how to make a link to a PDF file (name.PDF)?
body: <p>I am generating PDF files and my link look like this:</p>
  
  <pre><code>&lt;%= link_to 'Invoice', display_invoice_path(invoice.id), :format =&gt; :pdf %&gt;
  </code></pre>
  
  <p>When I click on this, it takes me to <strong>/display_invoice/123456789</strong> (it's an HTML version).</p>
  
  <p>In the controller action is following:</p>
  
  <pre><code>def display_invoice
      if params[:invoice_number]
        @invoice = ...
  
        respond_to do |format|
          format.html
          format.pdf do
            #render pdf: '123',                  # file name
            render pdf: params[:invoice_number],
                   layout: 'layouts/application.pdf.erb'#,  # layout used
                   #show_as_html: params[:debug].present?    # allow debuging
          end
        end
      end
    end
  </code></pre>
  
  <p>and in the routes:</p>
  
  <pre><code>  get '/display_invoice/:invoice_number', to: 'invoices#display_invoice', :as =&gt; 'display_invoice'
  </code></pre>
  
  <p>After clicking the link, I'd like to have in the URL <strong>/display_invoice/INVOICE_NUMBER.pdf</strong> - currently, there's just <strong>/display_invoice/INVOICE_NUMBER</strong>.</p>
  
  <p>How to open it with the ".pdf" suffix?</p>
  
  <p>Thank you.</p>