This project is archived and is in readonly mode.

#1630 ✓resolved
Joseph Palermo

Association preload include chain stops if it hits a nil object

Reported by Joseph Palermo | December 24th, 2008 @ 11:09 PM | in 2.x

If you have a singular association that is not guaranteed to be populated, when trying to include past that the preloading stops if the first returned value was nil.

For example: user has_one lunch lunch has_many tasty_snacks

User.find(:all, :include => {:lunch => :tasty_snacks})

If the first user returned from the find does NOT have a lunch, tasty_snacks are not loaded for any of the users, even if they have lunches.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages