# Eager loading problem

**URL:** <https://www.ruby-forum.com/t/eager-loading-problem/136190>\
**Category:** Deployment\
**Created:** [April 29, 2008, 6:21pm UTC](https://www.ruby-forum.com/t/eager-loading-problem/136190 "2008-04-29T18:21:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankit2584](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@ankit2584](https://www.ruby-forum.com/u/ankit2584)\
**Post date:** [April 29, 2008, 6:21pm UTC](https://www.ruby-forum.com/t/eager-loading-problem/136190/1 "2008-04-29T18:21:57Z")

</div>

Hi,  
I am trying eager loading with has\_many through association. But i get  
a could not find id error (detaiLs on error below) .

Models  
Presenceship  
belongs\_to :person  
belongs\_to :contactoccasion

Person  
has\_many :presenceships  
has\_many :contactoccasions through :presenceships  
has\_many relations  
#MOre person assocaitions here  
…

Contactoccasions  
has\_many :presenceships  
has\_many :people through :presenceships

Now when i try the statement

Person.find(:all, :conditions[…some  
condition.],:include=\>[:relations,{:presenceships=\>:contactoccasion})

i get an SQL error could not find id. I checked the development log and  
found this:

…presenceships.[id] AS t5\_r0, presenceships.[contactoccasion\_id] AS  
t5\_r1, presenceships.[person\_id] AS t5\_r2, contactoccasions.[id] AS  
t6\_r0, …  
i cannot understand why it tried to get presenceships.id

As it is a join association model it has no id column

Can anyone please tell me what is wrong???  
Thank you.
