Jónas Tryggvi Jóhannsson
2009-May-26 21:15 UTC
Duplicate joins when combining scopes and :include
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.