But is a plugin really required? Can't you feed something to find_by_sql that will get you both types of objects?
-----Original Message----- From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Frederick Cheung Sent: Tuesday, November 04, 2008 1:32 AM To: Ruby on Rails: Talk Subject: [Rails] Re: Using Inner/Outer join to eager fetch belongs_to associations On Nov 4, 7:00 am, Justin Holzer <[EMAIL PROTECTED]> wrote: > I did a bit more looking in to using a :conditions hash to force > ActiveRecord to fall back on the Rails 2.0 method of eager fetching > associations, and this is absolutely not what I am looking for. For > one, the Rails 2.0 eager fetch strategy always uses OUTER JOINs, and > it also includes a join for all associations specified as an :include, > rather than just those that are specified in a condition. > > I am looking for some way to essentially force ActiveRecord to eagerly > fetch specific associations/:include's using an INNER JOIN in the > query that is also being used to fetch the data for the base object. > The more I think about it, the more I think that this functionality > does not really exist in ActiveRecord, and it would have to be written > as an extension/plugin. > > However, since I'm pretty new to Rails, I wanted to put it to all the > experts on this forum before throwing in the towel. Yup you've got it pretty much all figured out. For what it's worth, when it was just a belongs_to/has_one, the overhead of generating the crazy query with the joins, the database running the query, rails doing its fancy parse thingy on the results meant that Foo.find 123456, :include => :bar was often no faster than f = Foo.find 123456 Bar.find 456798 Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---