Perhaps due to the very nice batch fetch and update changes that were introduced into core recently: http://groups.google.com/group/rubyonrails-core/browse_thread/thread/10d20373e99a0473 The find :include option appears to be completely ignored now, as of the 9216 gems. This example: @lobby_channels = find(:all, :include => [:players]) Does two SQL calls: SELECT * from lobby_channels Then on the first missing player: SELECT * from players WHERE id IN (115,610,1982) The new behavior of the bulk fetch is very nice, but the :include needs to still work for the case when you know you need other models ahead of time (saves DB load). Is this a known issue? Couldn''t find it browing the git commits... Thanks, Nate --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Apr-19 23:11 UTC
Re: ActiveRecord find :include appears broken in 9216 gems
On Apr 19, 9:17 pm, Nate Wiger <nwi...@gmail.com> wrote: @lobby_channels = find(:all, :include => [:players])> > Does two SQL calls: > > SELECT * from lobby_channels > > Then on the first missing player: > > SELECT * from players WHERE id IN (115,610,1982) > > The new behavior of the bulk fetch is very nice, but the :include > needs to still work for the case when you know you need other models > ahead of time (saves DB load). > > Is this a known issue? Couldn''t find it browing the git commits...This isn''t a recent change and it is deliberate (it falls back to the old implementation if the conditions or order reference one of the :included tables. The rest of the time the bulk fetch is the new implementation of :include. Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---