rails/rails — pull request #12718 by timsly (2013-10-31 17:17:11+00:00)
Title: make sure order quote symbol arguments

Current order implementation [contains symbol parsing and converting it to `Arel::Nodes::Ordering`](https://github.com/rails/rails/blob/master/activerecord/lib/active_record/relation/query_methods.rb#L1013)
But this code will be never executed, because we [preprocess symbol params and convert it to `Arel::Nodes::Ascending`](https://github.com/rails/rails/blob/master/activerecord/lib/active_record/relation/query_methods.rb#L1042).
But when we convert it to `Arel::Nodes::Ascending` it has issues with some values(for example `:key`, [see here #2601](https://github.com/rails/rails/issues/2601#issuecomment-27427606))

So i removed symbol preprocessing and leave all calculation on `build_order` method

Also this pull fixes `limited_ids_for` method for postgresql adapter, which is [passing `order_values`(raw values that we pass to order) to `columns_for_distinct`](https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#L474). So for symbol(after i removed preprocessing) and hash arguments it will raise `NoMethodError`, because [there is no `to_sql` method](https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#L476)