rails/rails — pull request #8225 by shemerey (2012-11-15 15:04:52+00:00)
Title: Fixe  #reverse_order incorrect behavior 

Fixed incorrect behavior in situations when the string containing function comes in method order. for example SUBSTR()
```
Sybase: SUBSTR(field, 1, 10)
MySql: SUBSTR(field, 1, 10)
Postgresql: SUBSTR(field, 1, 10)
Sqlite: SUBSTR(field, 1, 10)
Oracle: SUBSTR(field, 1, 10)
DB2: SUBSTR(field, 1, 10)
```
“,” was used as means for dividing fields where sorting takes place, as a result of that invalid sql was generated, example:

```Post.order('SUBSTR(name, 1, 10)').reverse_order.to_sql```

#### expected: ####
``` SELECT "posts".* FROM "posts" ORDER BY SUBSTR(name, 1, 10) DESC```
#### got ####
```SELECT "posts".* FROM "posts" ORDER BY SUBSTR(name DESC, 1 DESC, 10) DESC```

This fixes the incorrect behavior. for that purpose i added private method (#split_order_expressions) that split only by expected "," Other behavior was not affected.