Fix ActiveRecord's completely broken where merge semantics

This PR fixes an ActiveRecord bug that's currently causing a github/github test to fail.

```irb
irb(main):004:0> Repository.public.private.to_sql
=> "SELECT `repositories`.* FROM `repositories`  WHERE `repositories`.`public` = 0"
irb(main):005:0> Repository.private.public.to_sql
=> "SELECT `repositories`.* FROM `repositories`  WHERE `repositories`.`public` = 1"
```

In my testing, ActiveRecord 2.3, 3.0, and 4.0 correctly merge these two scopes and create an unsatisfiable WHERE clause. 3.1 and 3.2 are both broken and will override earlier conditions with later conditions.

Because 4.0 behaves correctly, I feel comfortable making this change to our fork of Rails as we're essentially backporting a bug fix here.

cc @github/rails @github/rails3