# manual eager loading for DataMapper module EagerLoading def eager_load(query_path) query_path.relationships.inject(self) do |collection, relationship| relationship.eager_load(collection) end self end end DataMapper::Collection.send(:include, EagerLoading)