Uploadify + Paperclip + Rails nested association before_save

亡梦爱人 提交于 2019-12-20 03:32:14

问题


I need to create a model application form where models can fill it and add pictures to it.

I'm following this example with Uploadify, Paperclip and Rails 3 approach. https://github.com/websymphony/Rails3-Paperclip-Uploadify

To the pictures, i have an polymorphic Attachment model and i would like to attach those ajax uploaded attachments to the yet unsaved model form and there's is where the tricky part cames.

Users are not logged, so there's no "model_id" until is saved.

Since i'm showing the user a small preview of the images that he uploaded in the form by ajax after each upload i need some way to correlate them.

I was thinking about some middle token until the model is saved but i'm not sure whats the best approach to accomplish this.

Thank you!


回答1:


We dumped Uploadify when moving to Rails 3 and are now using jQuery-File-Upload.

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

Setting up a bunch of middleware to do nothing more than upload files seems like a major hassle.

Only problem with the jquery solution is multiple uploads aren't supported in IE.



来源:https://stackoverflow.com/questions/4338779/uploadify-paperclip-rails-nested-association-before-save

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!