rails/rails — pull request #12011 by pftg (2013-08-24 16:20:35+00:00)
Title: Adds regressions tests for joins associations with scope block

For joining associations with scope block,
with string expressions in `where` statements
generate bad SQL expression.

There is hotfix for that issue:

```diff
--- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb
+++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb
@@ -122,7 +122,7 @@ module ActiveRecord
end

if rel && !rel.arel.constraints.empty?
- constraint = constraint.and rel.arel.constraints
+ constraint = rel.arel.constraints.inject(constraint) {|constraint, c| constraint.and c}
end

joins << join(table, constraint)
```

But the problem in `arel`: `rel.arel.constraints` should return `Node::And` instead of `Array` if where values has Nodes::Grouping, Nodes::GreaterThan and etc.Fast fix build `Node::And` from `Array`.

Working on PR for Arel.

Closes #11963