by Yannick S., on 14 April 2012
If you sometimes need to attach many files to a rails model, we find on the web a lot of tutos with uploadify and so on. Here is a simple way to do it only with HTML5, paperclip and rails.
class Attachment < ActiveRecord::Base
class Note < ActiveRecord::Base
array.each do |file|
attachments.build(:attachment => file)
With only that little of HTML5 magic, we can upload has many files that we want only by adding this input file in the note form.
<input type=file name=attachments_array multiple />
Everything You Need to Know About Moving to a SaaS Model.
Get the Guide Now →
Place de l'Université 251348 Louvain-la-NeuveBelgium