lib/parse/query.rb
def order(*ordering)
      @order ||= []
      ordering.flatten.each do |order|
        order = Order.new(order) if order.respond_to?(:to_sym)
        if order.is_a?(Order)
          order.field = Query.format_field(order.field)
          @order.push order
        end
      end #value.each
      @results = nil if ordering.count > 0
      self #chaining
    end
def order(*ordering)
      @order ||= []
      ordering.flatten.each do |order|
        order = Order.new(order) if order.respond_to?(:to_sym)
        if order.is_a?(Order)
          order.field = Query.format_field(order.field)
          @order.push order
        end
      end #value.each
      @results = nil if ordering.count > 0
      self #chaining
    end
def order ( * ordering ) @order ||= [ ] ordering . flatten . each do | order | order = Order . new ( order ) if order . respond_to? ( :to_sym ) if order . is_a? ( Order ) order . field = Query . format_field ( order . field ) @order . push order end end #value.each @results = nil if ordering . count > 0 self #chaining end
Add a sorting order for the query.
 @example
  # order updated_at ascending order
  Song.all :order => :updated_at

  # first order by highest like_count, then by ascending name.
  # Note that ascending is the default if not specified (ex. `:name.asc`)
  Song.all :order => [:like_count.desc, :name]
 @param ordering [Parse::Order] an ordering
 @return [self]
Add a sorting order for the query . @example # order updated_at ascending order Song . all : order = > : updated_at