Forum: Ruby on Rails Duplicate joins when combining scopes and :include

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.
74e79baaeac998bce28439af40b74bdf?d=identicon&s=25 Jónas Tryggvi Jóhannsson (Guest)
on 2009-05-26 23:21
(Received via mailing list)
Hi,

I have an app using Rails 2.3.2 that chains together multiple scopes
with joins and conditions on different tables. When I add :include to
the finders that use these scopes, I get an Mysql::Error saying Not
unique table/alias for the table that I'm including, and joining on in
scopes.

The join strings are exactly the same, but the same left outer join is
repeated in the SQL. I thought them being string identical would
prevent that from happening?

Is this a known problem with any workarounds? At the moment I just
skip the eager loading, which is hurting performance.

Thanks.
This topic is locked and can not be replied to.