Q:

Setting path to upload and email files Ruby on Rails

I'm currently working on a website with the following functionality: 

Users can post job listings. 
Interested users can click on the job listing, which brings them to an apply page. Here they have to upload their resume via file upload and click on send. 
The resume is now sent to the employers email. 

I know how to send my own attachments but I cannot get it to work so users upload their own resumes. Right now, I want to have them saved locally, and not using a different storage like S3. I am also using Paperclip and ActionMailer.
Here is the code that I have:
listings_controller.rb:
def send_resume_email
        @listing = Listing.find(params[:id])
        @user = User.find_by_id(params[:id])
        UserMailer.new_resume(@user, @listing).deliver
        redirect_to findjobs_path, notice: 'Message sent'
    end

user_mailer.rb:
def new_resume(user, listing)
    @listing = listing
    @user = user
    attachments['header.png'] = File.read("#{Rails.root}/app/assets/images/header.png", mode:     "rb")
    @url = 'http://www.example.com'
    mail(to: listing.user.email, subject: 'Thanks for the awesome site')

end

apply.html.erb:
<div class="top">
<div class="container-content">
    <div class="container">
        <%= form_tag(listing_send_resume_email_path, :html => { :multipart => true}) do %>

           <%= file_field_tag :file %>
           <%= submit_tag nil, class: 'btn btn-default btn-about pull-right' %>
       <% end %>
  </div>
</div>
</div>

A:

Since you don't want to store resumes, Paperclip is not required. You will have to pass file parameter from controller to the mailer.
In Controller:
UserMailer.new_resume(@user, @listing, params[:file]).deliver

In Mailer:
def new_resume(user, listing, file)
    @listing = listing
    @user = user
    @url = 'http://www.example.com'
    attachments["#{file.original_filename}"] = File.read(file.path)
    mail(to: listing.user.email, subject: 'Thanks for the awesome site')
end

Also, you might have to modify your form_tag as follows:
form_tag(listing_send_resume_email_path, multipart: true)

References:

http://api.rubyonrails.org/classes/ActionDispatch/Http/UploadedFile.html
http://guides.rubyonrails.org/action_mailer_basics.html

