title: Changing the file name that we upload using carrierwave in rails
body: <p>i am using <a href="http://richonrails.com/articles/allowing-file-uploads-with-carrierwave" rel="noreferrer">carrierwave</a> for uploading and downloading the files.
  This is my model:</p>
  
  <pre><code>class InvoiceDetail &lt; ActiveRecord::Base
      mount_uploader :attachment, AttachmentUploader
    validates :invoice_number, :supplier_name, :attachment, presence: true    
    validates_uniqueness_of :invoice_number
  end
  </code></pre>
  
  <p>attachment/uploader.rb:</p>
  
  <pre><code> def store_dir
      "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
    end
  </code></pre>
  
  <p>invoice_detail/_form.html.erb:</p>
  
  <pre><code>&lt;%= form_for(@invoice_detail , html: {class: 'form-horizontal', role: 'form' }) do |f| %&gt;
  
      &lt;div class="field"&gt;
          &lt;%= f.label :invoice_number, :class =&gt; 'control-label' %&gt;
              &lt;div class="controls"&gt;
      &lt;%= f.text_field :invoice_number, :class =&gt; 'text_field' %&gt;
    &lt;/div&gt;
    &lt;/div&gt;
      &lt;div class="field"&gt;
      &lt;%= f.label :supplier_name, :class =&gt; 'control-label' %&gt;
                  &lt;div class="controls"&gt;
  
      &lt;%= f.text_field :supplier_name, :class =&gt; 'text_field' %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
       &lt;div class="control-group"&gt;
        &lt;%= f.label :attachment , :class =&gt; 'control-label' %&gt;
        &lt;div class="controls"&gt;
          &lt;%= f.file_field :attachment, :class =&gt; 'file_field' %&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;div class="form-actions"&gt;
      &lt;%= f.submit "Create Invoice Details", :class =&gt; 'btn btn-primary' %&gt;
      &lt;%= f.submit "cancel", :class =&gt; 'btn btn-danger', method: :delete, data: { confirm: 'Are you sure you want to cancel' } %&gt;
  
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>The file which I upload is stored in public/uploads folder of my rails application. 
  Now my requirement is to upload the file with invoice_number i am entering in the form and when I click on download, the file has to be downloaded  with same Invoice number.
  (For example, i am entering my invoice number as :1234 and uploading file with name example.xlsx, the uploaded file has to be stored as 1234.xlsx)
  Please help me out.</p>