diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-23 13:48:09 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-23 13:48:09 -0700 |
commit | 6c266b4c3fd97cc6e4b01b72c3da69ed101cb3c6 (patch) | |
tree | c21754da5783be0605e61f5e2ec6a6c41a3b8d5e /lib/arel | |
parent | 66fc8add90445289f4926a914b0eea0c1989450f (diff) | |
download | rails-6c266b4c3fd97cc6e4b01b72c3da69ed101cb3c6.tar.gz rails-6c266b4c3fd97cc6e4b01b72c3da69ed101cb3c6.tar.bz2 rails-6c266b4c3fd97cc6e4b01b72c3da69ed101cb3c6.zip |
reordering order clauses :'(
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/visitors/postgresql.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/arel/visitors/postgresql.rb b/lib/arel/visitors/postgresql.rb index e8aa9b8cb3..87fc3bd60d 100644 --- a/lib/arel/visitors/postgresql.rb +++ b/lib/arel/visitors/postgresql.rb @@ -31,7 +31,15 @@ module Arel def aliased_orders orders #orders = o.orders.map { |x| visit x }.join(', ').split(',') - (0...orders.size).map { |i| "id_list.alias_#{i}" } + list = [] + orders.each_with_index do |o,i| + list << + [ + "id_list.alias_#{i}", + (o.index(/desc/i) && 'DESC') + ].compact.join(' ') + end + list end end end |