Sha256: c7736d1a9c6cda681e127fbb78a888100791cb7a14e36c92ae5d76bc10276ab9
Contents?: true
Size: 651 Bytes
Versions: 17
Compression:
Stored size: 651 Bytes
Contents
module ActiveRecord module QueryMethods def reverse_order order_clause = arel.order_clauses.join(', ') relation = except(:order) # CPK # order = order_clause.blank? ? # "#{@klass.table_name}.#{@klass.primary_key} DESC" : # reverse_sql_order(order_clause) order = unless order_clause.blank? reverse_sql_order(order_clause) else primary_keys = composite? ? @klass.primary_keys : [@klass.primary_key] primary_keys.map do |key| "#{@klass.table_name}.#{key} DESC" end.join(", ") end relation.order Arel::SqlLiteral.new order end end end
Version data entries
17 entries across 17 versions & 1 rubygems