Sunday, December 10, 2006

Find with :include ignores :order

A rails bug bit me today! Ouch!

Well, at least the bug report was clear and explained the workaround well:

Ticket #6679 (new defect)
find with :include ignores :order from has_many declaration

Basically, when you eager load an association from a has_many relationship, :order is totally ignored. To work-around, you have to specify :order again on the eager load.

No comments: