Sha256: 7e9f003269ba29be81106a69eb9033a5469b34681eca7d049bb1d0ca880abd83
Contents?: true
Size: 600 Bytes
Versions: 23
Compression:
Stored size: 600 Bytes
Contents
module CompositePrimaryKeys module ActiveRecord module QueryMethods def reverse_order order_clause = arel.order_clauses # CPK # order = order_clause.empty? ? # "#{table_name}.#{primary_key} DESC" : # reverse_sql_order(order_clause).join(', ') order = unless order_clause.empty? reverse_sql_order(order_clause).join(', ') else klass.primary_key.map do |key| "#{table_name}.#{key} DESC" end.join(", ") end except(:order).order(Arel.sql(order)) end end end end
Version data entries
23 entries across 23 versions & 1 rubygems