On 22 Aug 2008, at 18:20, Michael Koziarski wrote: > >> Could we get away with find :all returning a proxy that looked enough >> like an array that it wouldn't break everyone's apps ? > > Probably, but it's probably a fairly large amount of work. If people > want to work on it then I'm happy to help provide guidance and the > like, but it's probably going to take till 2.3 till we could have > something like this land. > > That's definitely the right approach but it's not going to be > s/Array/NewFancyProxy/g ;)
Well I'm up for a challenge :-) Was just playing around with things and adding def records.load associations self.first.class.send :preload_associations, self, associations unless self.empty? self end to find_every allows you to do stuff like conversations = Conversation.find :all conversations.load :messages => :author It's not hard to add this to association collection either. I don't think this approach can be taking any further and it does mean that you can't Marshal.dump what you get out of a find (not sure how much of an issue this is but there are tests around that area). I may just be being prematurely paranoid but if find returns a result set object and if the objects in that collection know the result set object (so that for example accessing an association can preemptively load that association for all of them) would you not have the problem that ruby would hold onto the entire result set as long as anyone was holding onto any single object in that collection ? Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en -~----------~----~----~----~------~----~------~--~---
