title: How to direct download the pdf file instead of redirecting it to new page using carrierwave in rails
body: <p>I am using <a href="http://richonrails.com/articles/allowing-file-uploads-with-carrierwave" rel="nofollow">carrierwave</a> for uploading and downloading the files.
  I am able to download all the files directly. But in case of pdf files, when I click on download it is redirecting to new page asking for open with, download and etc fields.
  Is there any way to direct download pdf files? (which is my client requirement)</p>
  
  <p>My controller:</p>
  
  <pre><code>  def show
   @invoice_detail = InvoiceDetail.find(params[:id])
  
    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml =&gt; @invoice_detail }
      format.pdf { render :layout =&gt; false }
    end
    end
  </code></pre>
  
  <p>attachment_uploader.rb:</p>
  
  <pre><code> def store_dir
      "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
    end
    def extension_white_list
      %w(xlsx pdf doc htm html docx png jpg jpeg xls)
    end
    def filename
    "#{model.invoice_number}.#{file.extension}" if original_filename.present?
  end
  </code></pre>
  
  <p>show.html.erb:</p>
  
  <pre><code>&lt;%= link_to 'download file', invoice_details.attachment_url %&gt;
  </code></pre>