Forum: Ruby on Rails eager loading kills the :select clause in ActiveRecord

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
10da297eedcca67860268ec3490f6f06?d=identicon&s=25 dino d. (Guest)
on 2009-01-29 22:59
(Received via mailing list)
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
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2009-01-30 12:59
(Received via mailing list)
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
This topic is locked and can not be replied to.