rails/rails — pull request #5949 by dazuma (2012-04-24 02:51:16+00:00)
Title: Support string substitution in the order clause

Support string substitutions in the order clause in ActiveRecord.

This helps cases when you want to order on an expression. For example:

```ruby
value = 10
MyModel.order(['(id % ?)', value])
```

Note that it uses a heuristic to distinguish between ordering by a list of values, and a single value that happens to be a string substitution (an sql sanitization). If the first item in an array is a string that contains a question mark, it is assumed that the intent is for that array to be a string substitution. I'm of course open to suggestions on this heuristic.