On Nov 9, 2:42 pm, Journeyer <[email protected]> wrote:
> What is custom :eager_loader BTW ?

Eager loading is when you have multiple attendances and you want to
get the child for all of them in a single query.  Let's say you are
doing:

  Attendance.all do |a|
    a.child
  end

That will do 1 query to get the attendances, and 1 query for each
attendance to get the related child.

Eager loading allows you to do:

  Attendance.eager(:child).all do |a|
    a.child
  end

That will do 1 query to get the attendances, and 1 query to get the
child for each attendance.  So if you have 1000 attendances, it saves
you 999 queries.

:eager_loader is the option you use to specify a custom eager loading
routine.  Since you are hard coding the acad_year in the association
block, you may not even need one.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to