# Eager loading a has\_many :through (Rails3)

**URL:** <https://www.ruby-forum.com/t/eager-loading-a-has-many-through-rails3/193893>\
**Category:** Rails\
**Created:** [August 26, 2010, 10:03am UTC](https://www.ruby-forum.com/t/eager-loading-a-has-many-through-rails3/193893 "2010-08-26T10:03:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lance](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@lance](https://www.ruby-forum.com/u/lance)\
**Post date:** [August 26, 2010, 10:03am UTC](https://www.ruby-forum.com/t/eager-loading-a-has-many-through-rails3/193893/1 "2010-08-26T10:03:54Z")

</div>

Hello all,

I’ve been trying out Rails 3 and can’t get past this issue:

I have a simple has\_many :through:

class Author \< ActiveRecord::Base  
has\_many :author\_series  
has\_many :series, :through =\> :author\_series  
end

class Series \< ActiveRecord::Base  
has\_many :author\_series  
has\_many :authors, :through =\> :author\_series  
end

In my controller I would like to eager load all of the authors:

@series = Series.includes(:authors).all

This will eager load the intermediate class, but only loads the first  
author record. When I iterate the others, they are each fetched  
individually (N+1).

Any help would be appreciated.
