问题
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