Hi Till, thanks for sharing this. > > There was a discussion about eager loading a while ago: > https://gist.github.com/1244491 > > We took that code (provided by d11wtq), changed some details and ended > up here: > https://gist.github.com/3162356 >
I guess hacking in the model's instance variables wasn't the best idea. But > I really like the API (using the QueryPath and a method in > DataMapper::Collection). > That's a beautiful API. I took those ideas and combined them with mine, and ended up improving my gist: https://gist.github.com/3100034 The one takes one or more query paths as arguments, and eager loads all the objects along each path. This is exactly what I was hoping to do, but I didn't expect it to be so simple ;) My next step will be to make something that extends DataMapper::Collection with a method that wraps things up into something more convenient. I'm not sure yet if I'll name the method #preload, #eager_load or something else. -- Dan -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To view this discussion on the web visit https://groups.google.com/d/msg/datamapper/-/hKVUeaewyIcJ. 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.
