Collapse where constraints to the Arel::Nodes::And node

In order to remove duplication with joining where constraints by ` AND ` on traverse `arel.constraints`,
refactored `collapse_wheres` to add to `arel.wheres` on `build_arel` only one node `Arel::Nodes::And`.

This refactoring remove duplication to which fixed #11963:

```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)
```
because `Arel::Nodes::Node#and` expected that argument (in our case `rel.arel.constraints`) is not `Array`, in that way `Arel::Visitors::ToSql` on visiting `Array` returns `, ` instead of ` AND `.