Question

I'm having a few problems with multi file uploads in rails 4, I've got it working using carrierwave and polymorphic associations but its creating a file filed for every image in the view. This makes sense as its creating fields for the associated model.

If there is a better or more standard way of doing this in rails 4 I'd be grateful for your advise.

Here is a gist to what I'm doing: https://gist.github.com/lperry65/5805b5f41495f8a820b7

Screen Shot http://cl.ly/image/3y3w203z3G1f

There seems to be lots of ways to accomplish this, but most of the info I found while googling is for rails 3. It's my intention to use UploadiFive for the front end once I iron out the wrinkles.

http://www.uploadify.com/download/download-uploadifive-standard/

Was it helpful?

Solution

Changing <%= f.fields_for :images do |i| %> to <%= f.fields_for :images[0] do |i| %> stopped the file input from being duplicated for every image. I can't say I'm happy with it but it works for now.

I'll update the gist to reflect any other changes, it's all working now so I'll leave it until I find a better solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top