I am searching for an easy solution how to multi upload more than one file.
The idea is that it should use polymorphic association, so I dont have to write another model for every model that will use attachment.
But I am stucked in how to join everything together.
Can please anybody show me the way how to use polymorphic association with multi file upload, eventually what is the best approach? Now I use Dragonfly so I thought it would be useless to use for example Carrierwave. I am asking because there is no detailed explanation of this problem.
**Attachment model:**
belongs_to :filable, polymorphic: true
dragonfly_accessor :file
**Parameters of attachment:**
file_uid (Dragonfly field)
file_name (Dragonfly field)
filable_id (polymorph)
filable_type (polymorph)
**Project model:**
has_many :attachments, as: :filable
So this is my code so far. Now how can I use form builder to upload multiple files?