Rails 4.2 Asynchronous Emails With Attachments From Multipart Form
|Added at||2016-10-21 18:10|
I'm implementing an idea-submission feature on our web app.
Users fill-in a multipart form which includes a file_field used to send a picture.
Upon successful form-submission, the web app has to asynchronoulsy send an email to one of our colleagues.
Said email has to include in its attachments the picture chosen by the user.
I know how to do this synchronously.
Doing this asynchronously is more complex.
Of course I won't store the picture inside the jobs table or redis.
The only clean solution I see is to copy the uploaded picture into a safe location on my server and store the path inside the job's meta-data. Upon success or after the limit of failures, the file is deleted.
Is there something already built-in in Rails?
Am I reinvening the weel or overcomplicating things?