rails/rails — pull request #4282 by al2o3cr (2012-01-03 20:27:37+00:00)
Title: correctly handle order calls after a reorder

Calling `reorder` on a relation currently makes the order passed the *final* order, regardless of any subsequent calls to `order`. For instance:
```
SomeModel.reorder('name ASC').order('created_at DESC').to_a
```
will execute:
```
SELECT * FROM some_models ORDER BY name ASC
```
(ignoring the `order` clause) rather than:
```
SELECT * FROM some_models ORDER BY name ASC, created_at DESC
```
as might reasonably be expected.

The included commit corrects this behavior. Calling `reorder` on a relation can now be described as 'start the ordering over again with this clause'. Subsequent calls to `order` will be appended rather than ignored.

This commit also unwinds the change (but not the test) in https://github.com/rails/rails/pull/4216 - that code is no longer needed, as `order_values` is now the authoritative source for a relation's order clauses.

Tested on master, but this should be applied to 3.2 as well.