Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rails/rails
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed May 18, 2009
2 parents 41e9414 + 5463823 commit ee5520a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/base.rb
Expand Up @@ -1542,12 +1542,12 @@ def find_last(options)
end end


def reverse_sql_order(order_query) 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)$/) if s.match(/\s(asc|ASC)$/)
s.gsub!(/\s(asc|ASC)$/, ' DESC') s.gsub!(/\s(asc|ASC)$/, ' DESC')
elsif s.match(/\s(desc|DESC)$/) elsif s.match(/\s(desc|DESC)$/)
s.gsub!(/\s(desc|DESC)$/, ' ASC') s.gsub!(/\s(desc|DESC)$/, ' ASC')
elsif !s.match(/\s(asc|ASC|desc|DESC)$/) else
s.concat(' DESC') s.concat(' DESC')
end end
}.join(',') }.join(',')
Expand Down

0 comments on commit ee5520a

Please sign in to comment.