How can I download the particular file which is uploaded using carrierwave?
<p>Hi I am using Ruby 2 and Rails 4. I am uploading a pdf file and its stored in <code>public/uploads/contact/file/15/abc.pdf</code> because I am using CarrierWave, and in my file_uploader.rb the below code is written.</p>

<pre><code>def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
 end
</code></pre>

<p>Now I want to download the same file which I uploaded. How can I download that  file? Please share with me if anyone has any idea. I am adding my code below.</p>

<p>Showing picture what I want to do exactly. Choosing a file upload it and then download it.
<a href="https://i.stack.imgur.com/d8AQ4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d8AQ4.png" alt="enter image description here"></a></p>

<p>My codes are:</p>

<p>downloads_form.html.erb</p>

<pre><code>&lt;table class="table table-condensed table-responsive"&gt;
        &lt;tbody&gt;
            &lt;%= form_tag create_form_path,  multipart: true  do |f| %&gt;
            &lt;tr&gt;                
                &lt;td&gt;ABC&lt;/td&gt;
                &lt;td&gt;&lt;%= file_field_tag "contact[file]",  class: "form-control" %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= submit_tag 'Upload' %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= link_to "Download", static_pages_downloadform_pdf_path %&gt;&lt;/td&gt;

            &lt;/tr&gt;
            &lt;tr&gt;               
                &lt;td&gt;DEF&lt;/td&gt;
                &lt;td&gt;&lt;%= file_field_tag "contact[file]",  class: "form-control" %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= submit_tag 'Upload' %&gt;&lt;/td&gt;
                &lt;td&gt;&lt;%= link_to "Download", static_pages_downloadform_pdf_path %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;% end %&gt; 

        &lt;/tbody&gt;
    &lt;/table&gt;
</code></pre>

<p>static_pages_controller.rb</p>

<pre><code>  def create_form
    @form_downup = Contact.new(contact_params)
    if @form_downup.save
      redirect_to :back
    else
      render downloads_form_path
    end
  end

  def downloadform_pdf

  end

 private
    def contact_params
       params.require(:contact).permit(:file)

    end
</code></pre>

<p>routes.rb</p>

<pre><code>  match '/downloads_form', to: 'static_pages#downloads_form', via: 'get', as: :downloads_form
  match '/create_form', to: 'static_pages#create_form', via: 'post', as: :create_form     
  get "static_pages/downloadform_pdf"
</code></pre>