On 11 November 2011 10:35, Mauro <mrsan...@gmail.com> wrote: > How you manage document names? > Do you create a folder for every company in which save their documents > or rename documen name to avoid duplicates or to avoid rewrites?
I have a polymorphic AttachingType model, which has a FileAttachment model associated to it. The file attachment stores info about the file size, mime type, original name, etc, and I renamed the file to be the id of the file_attachment object (and the original file extension) and save it to a local folder. If I think I'm going to have *lots* of files in the folder (in the order of tens of thousands), I break the structure down and put all ids beginning with 1 in one sub-folder, 2 goes in another, etc. In my models I create a AttachingTypePhoto (for instance) association and all the rest "just works". I should *really* polish-up the code and stick it in the public domain :-/ -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.