I am using the Mailboxer gem
.
What is the best way to set up my controller so it saves all the attachments? (loop through it?)
Would making a new model called message_attachment
be a good idea? In that case, how do I set up the message model (which I currently don't have in my model folder) so I can include has_many :message_attachments
please provide me a solution or a sample code thanks.
I can show you path.
First off, you need to fork the repository and make changes in Mailboxer::Message
model for
has_many :attachments
accepts_nested_attributes_for :attachments
Then you can add Mailboxer::Attachment
model and associate it with Mailboxer::Message
using belogns_to :message
After that modify the relevant controller to permit attachments assuming your form is passing attributes following rails convention for nested attributes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.