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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jónas Tryggvi Jóhannsson (Guest)
on 2009-05-27 01:21
(Received via mailing list)

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

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.

This topic is locked and can not be replied to.