Forum: Ruby on Rails eager loading not working in production mode

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2007-04-26 17:35
(Received via mailing list)
i have an eager load query as such:

    @groups = ReviewQuestionGroup.find(:all,
      :conditions => ["review_category_id = ?",],
      :order => 'review_question_groups.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
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2007-05-01 14:56
(Received via mailing list)
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

it was working properly in development mode since the dev database
already had the id and foreign key fields defined as INTEGER.
This topic is locked and can not be replied to.