motion/adapters/array_finder_query.rb
def order(field = nil, &block)
      if block_given?
        @collection = @collection.sort{|o1, o2| yield(o1, o2)}
      else
        raise ArgumentError.new('you must supply a field name to sort unless you supply a block.') if field.nil?
        @collection = @collection.sort{|o1, o2| o1.send(field) <=> o2.send(field)}
      end
      self
    end
def order(field = nil, &block)
      if block_given?
        @collection = @collection.sort{|o1, o2| yield(o1, o2)}
      else
        raise ArgumentError.new('you must supply a field name to sort unless you supply a block.') if field.nil?
        @collection = @collection.sort{|o1, o2| o1.send(field) <=> o2.send(field)}
      end
      self
    end
def order ( field = nil , & block ) if block_given? @collection = @collection . sort { | o1 , o2 | yield ( o1 , o2 ) } else raise ArgumentError . new ( 'you must supply a field name to sort unless you supply a block.' ) if field . nil? @collection = @collection . sort { | o1 , o2 | o1 . send ( field ) <=> o2 . send ( field ) } end self end
Specifies how to sort. only ascending sort is supported in the short
 form. For descending, implement the block form.

     Task.where(:name).eq('bob').order(:pay_grade).all  => array of bobs ascending by pay grade
     Task.where(:name).eq('bob').order(:pay_grade){|o1, o2| o2 <=> o1}  => array of bobs descending by pay grade
Specifies how to sort . only ascending sort is supported in the short form . For descending implement the block form .