This project is archived and is in readonly mode.
has_many :through associations give different results depending on eager-loading via :include
-
Tatsuya Ono
I wrote a patch for this issue against 2-3-stable.
I also put a simple project on github which allows you to reproduce this issue easily.
http://github.com/ono/eager_load_issue/tree/masterClone it then run rake test. It will be failed despite for it should be passed.
# sets up data u1 = User.find :all u2 = User.find :all, :include=>['posts_commented'] assert_equal u1[0].posts_commented.size, u2[0].posts_commented.sizeYou will succeed to pass the test if you apply the patch attached.
-
Jon Leighton
- Assigned user set to Aaron Patterson
- Importance changed from to
Can this ticket be closed or at least marked as stale please? If you look at
association_preload.rbin current master, you will see that it doesArray.wrap(associated_record), which deals with the case ofassociated_recordbeing nil, which is the source of the problem reported.
