On Aug 19, 3:52 pm, Aldric Giacomoni <rails-mailing-l...@andreas- s.net> wrote: > This may be the wrong question to ask, but I'll start here anyway > because this could probably use some optimization. > The code underneath gets a list of all the files in all the folders > specified, then deletes the database entries that aren't in that list, > updates the entries in both the db and the list, and creates the entries > that aren't in the db.
Question: why do you need to duplicate the filesystem's directory information in the DB? > > Is there a better way to do this? [...] Almost certainly. Notice that you're using find_by_filename each time through the loop. That's a pretty good indication that something's wrong; in general, database queries do not belong inside loops. I'll try to come up with something better, but first I'd like to know what you're trying to achieve here. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

