[Catalyst-commits] r8315 - in CatalystX-CRUD/CatalystX-CRUD/trunk: . lib/CatalystX/CRUD

karpet at dev.catalyst.perl.org karpet at dev.catalyst.perl.org
Thu Aug 28 19:53:59 BST 2008


Author: karpet
Date: 2008-08-28 19:53:58 +0100 (Thu, 28 Aug 2008)
New Revision: 8315

Modified:
   CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
   CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm
Log:
change behaviour of get_primary_key() in base Controller to not look in req->params for pk values

Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/Changes	2008-08-28 18:36:02 UTC (rev 8314)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/Changes	2008-08-28 18:53:58 UTC (rev 8315)
@@ -150,5 +150,7 @@
         * change all reserved param names in Model::Utils to use 'cxc-' prefix instead of '_'. Backwards compat
           is preserved where possible.
         * Model::Utils make_query() will uc() sort direction 
+        * change behaviour of get_primary_key() in base Controller to not look in req->params for pk values.
+          This allows for changing the PK as part of an update.
 
 

Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm	2008-08-28 18:36:02 UTC (rev 8314)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Controller.pm	2008-08-28 18:53:58 UTC (rev 8315)
@@ -155,8 +155,9 @@
 Should return an array of the name of the field(s) to fetch() I<pk_value> from
 and their respective values.
 
-The default behaviour is to return B<primary_key> and any corresponding
-value(s) passed via $c->req->params.
+The default behaviour is to return B<primary_key> and the
+corresponding value(s) from I<pk_value>.
+
 However, if you have other unique fields in your schema, you
 might return a unique field other than the primary key.
 This allows for a more flexible URI scheme.
@@ -188,19 +189,11 @@
     if ( ref $pk ) {
         my @val = split( m/;;/, $id );
         for my $col (@$pk) {
-            my $v
-                = exists $c->req->params->{$col}
-                ? $c->req->params->{$col}
-                : shift(@val);
-            push( @ret, $col => $v );
+            push( @ret, $col => shift(@val) );
         }
     }
     else {
-        @ret = (
-              $pk => exists $c->req->params->{$pk}
-            ? $c->req->params->{$pk}
-            : $id
-        );
+        @ret = ( $pk => $id );
     }
     return @ret;
 }




More information about the Catalyst-commits mailing list