Skip to content

Instantly share code, notes, and snippets.

Chris Corbyn d11wtq

  • Melbourne, Australia
Block or report user

Report or block d11wtq

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@postmodern
postmodern / dm_eager_loader.rb
Created Oct 27, 2011
Fork of d11wtq's DataMapper EagerLoader plugin
View dm_eager_loader.rb
module DataMapper
class Collection
#
# EagerLoader takes a QueryPath object and loads all relationships
# referenced in the path, into an existing Collection.
#
# Using eager-loading allows you to optimize out the classic "n+1"
# query problem, when you intend to iterate over several arbitrarily deeply
# nested relationships. One query per relationship is executed,
# vs one query per record.
You can’t perform that action at this time.