Joseph Palermo
2008-Dec-24 23:17 UTC
Patch for bug in preload_associations when first object has nil associate
This fix seems pretty straightforward to me, but review would be appreciated in case the implementation that was causing this problem was done for a good reason. http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1630-association-preload-include-chain-stops-if-it-hits-a-nil-object 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. 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---