I have a legacy database that I just need to write a report off of,
basically looking for duplicate entries. The schema is basically like
this:

class Profile
  has n, :registrations
end

class Registration
  belongs_to :profile
  has n, :signups
  has n, :payments
end

class Signup
  belongs_to :registration
  belongs_to :event
  has n, :payments
end

class Payment
  belongs_to :registration
  belongs_to :signup
end

class Event
  has n, :signups
  has n, :payments, :through => :signups
end

I just want to print out a table of all of the profiles, each with
it's registrations, each with it's event signups, each with it's
payments. The problem is that it is resulting in (n+1)*(n+1)*(n+1)*(n
+1) queries. Is there a way to force DataMapper to do eager loading of
these nested models right from the start? Is there some pre-loading
that would make more sense?

FWIW, I'm new to both Ruby and DataMapper.

-- 
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