# Eager Loading Polymorphic Associations

**URL:** <https://discuss.rubyonrails.org/t/eager-loading-polymorphic-associations/28321>\
**Category:** rubyonrails-talk\
**Created:** [April 21, 2008, 3:08pm UTC](https://discuss.rubyonrails.org/t/eager-loading-polymorphic-associations/28321 "2008-04-21T15:08:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_C](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Joe\_C](https://discuss.rubyonrails.org/u/Joe_C)\
**Post date:** [April 21, 2008, 3:08pm UTC](https://discuss.rubyonrails.org/t/eager-loading-polymorphic-associations/28321/1 "2008-04-21T15:08:30Z")

</div>

Hi,

I’m searching for a method of eager loading polymorphic associations under activerecord [2.0.2.](http://2.0.2.) After some initial google-fu I came up with a link to an enhancement that’s been added to edge: [http://dev.rubyonrails.org/ticket/8119](http://dev.rubyonrails.org/ticket/8119)

Anyone have any idea how long that might take to work its way into a general release? I’m early in development now so I can afford to wait a while instead of introducing any dubious work arounds.

Thanks!

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [April 21, 2008, 3:25pm UTC](https://discuss.rubyonrails.org/t/eager-loading-polymorphic-associations/28321/2 "2008-04-21T15:25:32Z")

</div>

That patch is not in the current edge. Current edge has a different :include mechanism (from ticket 9640) which does know how to eager load polymorphic associations, so 2.1 will be able to do this. I don't have the faintest clue when 2.1 will be out, but if running edge for now is an option then you might want to go with that (or try and backport that patch to 2.0.2. I imagine it would apply without too much difficulty, but then you'd also want to track down any bug fixes made to it)

Fred

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [April 21, 2008, 3:30pm UTC](https://discuss.rubyonrails.org/t/eager-loading-polymorphic-associations/28321/3 "2008-04-21T15:30:37Z")

</div>

I should also point out that 9640 solves the problem in an entirely different way

Fred
