szimek
2008-Sep-07 12:24 UTC
How to properly upload a file in the same form as a parent model?
Hi, let''s say you got a Gallery model that has one (to simplify things a bit for now) Image (attachment_fu model). Gallery has i.e. title and description, both fields are required. In the "create new gallery form" you can set title, description and upload the image as well. What to do if the gallery object validation fails? How do you handle such situations? Do you create the image anyway, so when user is redirected back to the form to fix errors, he doesn''t have to upload the image again or do you require them to upload the image again? It''s not a big deal if there''s only one image per gallery, but what if gallery could have many images and user would have to upload again 10 images, just to fix the missing title? Is there an easy solution for such problem (without making "draft" objects (like i.e. emails in GMail), or making separate form for gallery and images)? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---