reverse_sql_order(order_query) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/relation/query_methods.rb, line 1080
    def reverse_sql_order(order_query)
      order_query = ["#{quoted_table_name}.#{quoted_primary_key} ASC"] if order_query.empty?

      order_query.flat_map do |o|
        case o
        when Arel::Nodes::Ordering
          o.reverse
        when String
          o.to_s.split(',').map! do |s|
            s.strip!
            s.gsub!(/\sasc\Z/, ' DESC') || s.gsub!(/\sdesc\Z/, ' ASC') || s.concat(' DESC')
          end
        else
          o
        end
      end
    end
Register or log in to add new notes.