There's a strange behaviour on AR in which using merge on a scope varies the order of the joins depending on how you define the join (string vs symbol).
Here's the testcase:
https://gist.github.com/iwiznia/7547713
I know that in the test there's a table that doesn't exist, it's there only to check the order of the join clauses.
There are 3 tests which should yield the same result, but when you combine joins as strings and joins as symbols or classes, it mangles the order of the joins.
Maybe it has to do with the fact that it's using the join_sources of the Arel::SelectManager class, but I thought that was a valid use case, and doing the same thing, but calling to_sql first solves the error.
What do you think? Is this a bug? I think it is since the three join statements should produce the same sql.
There's a strange behaviour on AR in which using merge on a scope varies the order of the joins depending on how you define the join (string vs symbol).
Here's the testcase:
https://gist.github.com/iwiznia/7547713
I know that in the test there's a table that doesn't exist, it's there only to check the order of the join clauses.
There are 3 tests which should yield the same result, but when you combine joins as strings and joins as symbols or classes, it mangles the order of the joins.
Maybe it has to do with the fact that it's using the join_sources of the Arel::SelectManager class, but I thought that was a valid use case, and doing the same thing, but calling to_sql first solves the error.
What do you think? Is this a bug? I think it is since the three join statements should produce the same sql.