I'm using Mandrill as Inbound email routing and I'm using those gems to receive emails and save it in a database.
How can I save the attachments in separated database table "Attachments
" using paperclip.
I'm using Mandrill as Inbound email routing and I'm using those gems to receive emails and save it in a database.
How can I save the attachments in separated database table "Attachments
" using paperclip.
Griddler::Email
has an attachments
attribute, which is:
An array of File objects containing any attachments.
So, if you have a model like this:
class Assessment
has_attached_file :file
end
You would simply do, for example:
@email.attachments.each{|f| Attachment.create(file: f)}