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:
commit
ee5520a0a5
1 changed files with 2 additions and 2 deletions
|
@ -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(',')
|
||||
|
|
Loading…
Reference in a new issue