--- !ruby/object:RI::ClassDescription 
attributes: []

class_methods: []

comment: 
- !ruby/struct:SM::Flow::P 
  body: Implements the details of eager loading of ActiveRecord associations. Application developers should not use this module directly.
- !ruby/struct:SM::Flow::P 
  body: ActiveRecord::Base is extended with this module. The source code in ActiveRecord::Base references methods defined in this module.
- !ruby/struct:SM::Flow::P 
  body: Note that 'eager loading' and 'preloading' are actually the same thing. However, there are two different eager loading strategies.
- !ruby/struct:SM::Flow::P 
  body: "The first one is by using table joins. This was only strategy available prior to Rails 2.1. Suppose that you have an Author model with columns 'name' and 'age', and a Book model with columns 'name' and 'sales'. Using this strategy, ActiveRecord would try to retrieve all data for an author and all of its books via a single query:"
- !ruby/struct:SM::Flow::VERB 
  body: "  SELECT * FROM authors\n  LEFT OUTER JOIN books ON authors.id = books.id\n  WHERE authors.name = 'Ken Akamatsu'\n"
- !ruby/struct:SM::Flow::P 
  body: However, this could result in many rows that contain redundant data. After having received the first row, we already have enough data to instantiate the Author object. In all subsequent rows, only the data for the joined 'books' table is useful; the joined 'authors' data is just redundant, and processing this redundant data takes memory and CPU time. The problem quickly becomes worse and worse as the level of eager loading increases (i.e. if ActiveRecord is to eager load the associations' assocations as well).
- !ruby/struct:SM::Flow::P 
  body: The second strategy is to use multiple database queries, one for each level of association. Since Rails 2.1, this is the default strategy. In situations where a table join is necessary (e.g. when the +:conditions+ option references an association's column), it will fallback to the table join strategy.
- !ruby/struct:SM::Flow::P 
  body: See also ActiveRecord::Associations::ClassMethods, which explains eager loading in a more high-level (application developer-friendly) manner.
constants: []

full_name: ActiveRecord::AssociationPreload::ClassMethods
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: preload_associations
name: ClassMethods
superclass: 
