# Eager loading not working in production mode

**URL:** <https://www.ruby-forum.com/t/eager-loading-not-working-in-production-mode/93016>\
**Category:** Rails\
**Created:** [April 26, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/eager-loading-not-working-in-production-mode/93016 "2007-04-26T17:35:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jemminger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@jemminger](https://www.ruby-forum.com/u/jemminger)\
**Post date:** [April 26, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/eager-loading-not-working-in-production-mode/93016/1 "2007-04-26T17:35:55Z")

</div>

i have an eager load query as such:

```
@groups = ReviewQuestionGroup.find(:all,
  :conditions => ["review_category_id = ?", @review.category.id],
  :order => 'review_question_groups.position,

```

review\_questions.position’,  
:include =\> :questions)

in dev mode, this works fine… i get results like  
@groups[0].questions.length = 13. in production, i get length = 0 for  
all of the questions associations.

rails is issuing the same SQL statement for both modes, and issuing  
that SQL statement manually against the prod database gives the proper  
results. no errors or exceptions are being thrown or logged that i  
can see.

using rails 1.2.3, oracle 9i

---

<div class="post-metadata">

**Author:** ![jemminger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@jemminger](https://www.ruby-forum.com/u/jemminger)\
**Post date:** [May 1, 2007, 2:56pm UTC](https://www.ruby-forum.com/t/eager-loading-not-working-in-production-mode/93016/2 "2007-05-01T14:56:00Z")

</div>

solved - turns out it was an oracle problem: the production database  
had the id and foreign key fields defined as NUMBER instead of  
INTEGER, which rails turns into floats.

the eager loading query is the same, but the sql rails issues to  
eagerly populate the association collections ends up being like “where  
group\_id = 1.0”, and so the query returns zero results. changing the  
column types in oracle to INTEGER as they should have been fixes the  
problem.

it was working properly in development mode since the dev database  
already had the id and foreign key fields defined as INTEGER.
