# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 408def add_order_by_for_association_limiting!(sql,options)returnsqlifoptions[:order].blank?order=options[:order].split(',').collect{|s|s.strip}.reject(&:blank?)order.map!{|s|'DESC'ifs=~/\bdesc$/i}order=order.zip((0...order.size).to_a).map{|s,i|"id_list.alias_#{i}#{s}"}.join(', ')sql.replace"SELECT * FROM (#{sql}) AS id_list ORDER BY #{order}"end