• B
    Fix that #exists? can produce invalid SQL: "SELECT DISTINCT DISTINCT" · 15d6e4dc
    Ben Woosley 提交于
    The combination of a :uniq => true association and the #distinct call
    in #construct_limited_ids_condition combine to create invalid SQL, because
    we're explicitly selecting DISTINCT, and also sending #distinct on to AREL,
    via the relation#distinct_value.
    
    Rather than build a select distinct clause in #construct_limited_ids_condition,
    I set #distinct! and pass just the columns into the select statement.
    This requires introducing a #columns_for_distinct method to return the
    select columns but not the statement itself.
    15d6e4dc
finder_test.rb 33.3 KB