[Catalyst-commits] r8299 - in CatalystX-CRUD/CatalystX-CRUD/trunk:
. lib/CatalystX/CRUD
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Wed Aug 27 04:34:59 BST 2008
Author: karpet
Date: 2008-08-27 04:34:59 +0100 (Wed, 27 Aug 2008)
New Revision: 8299
Modified:
CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm
Log:
refactor create() to make it easier to get at superclass
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/Changes 2008-08-26 20:22:32 UTC (rev 8298)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/Changes 2008-08-27 03:34:59 UTC (rev 8299)
@@ -141,5 +141,8 @@
0.30 xxx
* fix uninit value warning in Controller
+ * change REST create() : Local to _rest_create() : Path('create') to make it easier for
+ create_form() to call create() in superclass.
+
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm 2008-08-26 20:22:32 UTC (rev 8298)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/REST.pm 2008-08-27 03:34:59 UTC (rev 8299)
@@ -93,10 +93,9 @@
__PACKAGE__->config( enable_rpc_compat => 0 );
-sub create_form : Local {
+sub create_form : Path('create_form') {
my ( $self, $c ) = @_;
- $self->fetch( $c, 0 );
- $self->edit($c);
+ $self->create($c);
}
sub edit_form : PathPart Chained('fetch') Args(0) {
@@ -110,7 +109,12 @@
=cut
-sub create : Local {
+# no-op to undo the superclass Local attr
+sub create {
+ shift->next::method(@_);
+}
+
+sub _rest_create : Path('create') {
my ( $self, $c ) = @_;
$c->res->redirect( $c->uri_for( $self->action_for('create_form') ) );
}
More information about the Catalyst-commits
mailing list