1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge branch 'master' of git@github.com:rails/rails

This commit is contained in:
Jeremy Kemper 2009-05-18 15:02:15 -07:00
commit ee5520a0a5

View file

@ -1542,12 +1542,12 @@ module ActiveRecord #:nodoc:
end
def reverse_sql_order(order_query)
reversed_query = order_query.to_s.split(/,/).each { |s|
order_query.to_s.split(/,/).each { |s|
if s.match(/\s(asc|ASC)$/)
s.gsub!(/\s(asc|ASC)$/, ' DESC')
elsif s.match(/\s(desc|DESC)$/)
s.gsub!(/\s(desc|DESC)$/, ' ASC')
elsif !s.match(/\s(asc|ASC|desc|DESC)$/)
else
s.concat(' DESC')
end
}.join(',')