I currently have a Note model that accepts nested attributes for the Attachments model that uses Carrierwave. When adding a note, I have a nested form that allows you to attach the file to a new Note:
Nested form field:
<%= f.file_field :image, multiple: true, name: "attachment[file]" %>
I use Cocoon Stone to add a nested field. Although I can easily let them add several fields for uploading files using Cocoon and add several attachments there, I want to upload only one field for uploading files and let them use multi select to select multiple images.
When I do this, the file upload box says β2 imagesβ next to it. However, when submitting the form, only one file is listed in the attachments_attributes section. I need all attachments to be sent immediately, since the Note has not yet been saved.
What is the right way to do this? I know Railscast on this topic, but it does not seem to apply to my specific scenario.
Any help is appreciated.
source share