Hi Till,
thanks for sharing this.
We took that code (provided by d11wtq), changed some details and ended up here:
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:
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