Uploadify + Paperclip + Rails nested before_save

I need to create a model application form in which models can fill it out and add photos to it.

I follow this example using the Add, Clip, and Rails 3 methods. https://github.com/websymphony/Rails3-Paperclip-Uploadify

I have a polymorphic attachment model for images, and I would like to attach these loaded ajax attachments to the model's unsaved form, and there is a complicated part of cames there.

Users are not registered, so there is no "model_id" until it is saved.

Since I am showing the user a small preview of the images that he uploaded in ajax form after each upload, I need some way to correlate them.

I was thinking of some sort of middle token until the model is saved, but I'm not sure what the best approach is for this.

Thank!

+2
source share
1 answer

We overloaded Uploadify when switching to Rails 3 and now use jQuery-File-Upload.

https://github.com/blueimp/jQuery-File-Upload

Setting up the middleware pool to do nothing more than downloading files seems to be a big problem.

The only problem with the jquery solution is that multiple downloads are not supported in IE.

+2
source

Source: https://habr.com/ru/post/1778742/


All Articles