Well, one option is to just call #to_a on Thing.all, the other is to allow Collection#each to turn off eager loading: http://gist.github.com/299818 (you don't affect anything else in datamapper this way)
On Feb 8, 7:23 am, Farley Knight <farleykni...@gmail.com> wrote: > I have created a slightly modified test to show you what kind of > results I'm getting: > > http://gist.github.com/298126 > > I create 10 things and then find the widget count on each of them. It > does query the counts alone, but it the second SQL line from the line > of dashes it loads all of the existing widgets into memory, which is > where my app is slowing down, since I have several of these things and > perhaps at least 50-100 widgets per thing, with more data associated > with each record. It never quite loads and just gets killed by > Dreamhost. I assume that DM thinks that since I'm iterating over all > of the things that I'm probably going to be iterating over all of the > widgets as well.. Not sure how to tell it otherwise.. > > On Feb 3, 4:28 am, Jonathan Stott <jonathan.st...@gmail.com> wrote: > > > > > On Tue, 2 Feb 2010 15:18:53 -0800 (PST) > > > Farley Knight <farleykni...@gmail.com> wrote: > > > Thanks for responding. This is a decent quick fix but I'm trying to > > > push DataMapper into a drop in ActiveRecord replacement for a decent > > > sized codebase. It seems to almost fit but there are a couple of edges > > > that are poking out. > > > Hi > > > I'm curious, which version of ruby and dm are you using? And are you using > > dm-aggregates? > > > Have a look at this gist: > > >http://gist.github.com/293500 > > > That's what I see on my computer, which is running dm-core 0.10.2, ruby > > 1.9.1 and (most importantly) has dm-aggregates required. > > > Regards > > Jon -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.