drnic/composite_primary_keys — pull request #143 by tbeauvais (2012-12-12 20:24:45+00:00)
Title: Patched to AR reverse_sql_order method to brake apart CPKs

This is related to #133 which I closed in exchange of this new pull request. Since reverse_order has changed in recent versions of AR you suggested removing the CPK override of that method, which sounds correct. This exposed another issue in ActiveRecord::QueryMethods reverse_sql_order(..) method. The problem in there is it's using the primary_key to build up the sort order. I solved this by creating a reverse_sql_order alias, then overriding the reverse_sql_order where I break apart the CPKs, and then pass that into the original reverse_sql_order method.