hi I''ve dramatically improved my SQL performance with eager loading, but the problem is, it kills the :select directive because it generates its own (it ONLY selects the table fields and eager loaded table fields). Is there a way around this? I have some left outer joins in my :joins clause, and some aliasing in my :select clause, but the :include clause kills the select aliases. any advice? thanks, dino --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Reginald James
2009-Jan-30 11:58 UTC
Re: eager loading kills the :select clause in ActiveRecord
dino d. wrote:> I''ve dramatically improved my SQL performance with eager loading, but > the problem is, it kills the :select directive because it generates > its own (it ONLY selects the table fields and eager loaded table > fields). Is there a way around this? I have some left outer joins in > my :joins clause, and some aliasing in my :select clause, but > the :include clause kills the select aliases. any advice?Not supported at present, though I have a plugin that makes this work for Rails 2.0.2, not yet ported to 2.1+: http://dev.rubyonrails.org/ticket/7147#comment:12 There is another plugin that works with 2.2 that allows you to load object hierarchies when using custom SQL: http://rubyforge.org/projects/eagerfindersql -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---