On 5/9/05, John-Mason P. Shackelford
<john-mason-Grinw8Jr/8zZYwk40xCobA@public.gmane.org>
wrote:> Am I missing an obvious way to use Eager loading across several
associations?
>
> For example, I have tables: Divisions, Teams, and Users where Divisions
> has_many teams and teams has_and_belongs_to_many users. My page displays
> all
> of the Divisions, their teams, and the users for each team.
>
> The following works but does not eager load the users. How would I add
them?
>
> @divisions = Division.find(
> :all,
> :include => [ :teams ],
> :conditions => conditions,
> :order => ''teams.name''
> )
>
> Thanks very much,
>
> John-Mason Shackelford
>
> Software Developer
> Pearson Educational Measurement
>
> 2510 North Dodge St.
> Iowa City, IA 52245
> ph. 319-354-9200x6214
> john-mason.shackelford-uJfvbxoDSvxBDgjK7y7TUQ@public.gmane.org
> http://pearsonedmeasurement.com
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
I don''t believe it is possible at the moment to eagerly load
associations more than one level deep.
Jason