[Jifty-commit] r4808 - in jifty/trunk: lib/Jifty/Plugin/REST

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jan 10 15:57:26 EST 2008


Author: sartak
Date: Thu Jan 10 15:57:25 2008
New Revision: 4808

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm

Log:
 r50048 at onn:  sartak | 2008-01-10 15:56:42 -0500
 Use add_order_by for REST's __order_by, except the first time when we do want
 to wipe out the default ordering


Modified: jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm	Thu Jan 10 15:57:25 2008
@@ -489,10 +489,21 @@
             my $col = shift;
             my $order = shift || 'ASC';
 
-            $collection->order_by(
-                column => $col,
-                order  => $order,
-            );
+            # this will wipe out the default ordering on your model the first
+            # time around
+            if ($added_order) {
+                $collection->add_order_by(
+                    column => $col,
+                    order  => $order,
+                );
+            }
+            else {
+                $added_order = 1;
+                $collection->order_by(
+                    column => $col,
+                    order  => $order,
+                );
+            }
         },
     );
 


More information about the Jifty-commit mailing list