FND, do you ned this in more than one place, or just for something that's 
proving to be a bottleneck at one point in your app.  It's probably possible to 
"help" DM from the outside in, if you want to eager-load an association as a 
one-off optimisation, until it's part of dm-core.  I'd need to know what the 
relationships are before I even begin trying to write the code to do it, but 
it's almost certainly possible, by collecting the needed keys from what's 
already loaded, the loading the correct models *not* via the association… you 
could hook up the associations again once you've preloaded the children, if you 
want to be able to iterate like DM had done it all along.  It probably requires 
some fairly intricate knowledge of how DM loads associations, but nothing a bit 
of poking around can't help.

Having it "just work" implicitly is a whole different ball game though.  I'm 
impressed it even works up to 2 levels deep right now :)


On 29/09/2011, at 4:36 PM, FND wrote:

>> Essentially I'm trying to make it so I don't get N+1 queries
> 
> It appears this is currently not supported:
> https://github.com/datamapper/dm-core/issues/112
> 
> I would also appreciate an update on this issue. As stated on the
> ticket, I'd be happy to help, but not quite sure how yet.
> 
> 
> -- F.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" 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/datamapper?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en.

Reply via email to