X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FBasicCRUD.pod;h=b6afd45b780b9c91c23b3d7d43299c483385b9f7;hp=d636da4039dae865799e2f397373cb001d1004ef;hb=0416017e10f523ec522ef48e0acef28217b57b55;hpb=4e1c81079691f91c7ab2c3b65ba0d981af660e04 diff --git a/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod b/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod index d636da4..b6afd45 100644 --- a/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod +++ b/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod @@ -631,12 +631,31 @@ right side of the table with a C "button" (for simplicity, links will be used instead of full HTML buttons). Also notice that we are using a more advanced form of C than -we have seen before. Here we use C<$c-Econtroller-Eaction_for> -to automatically generate a URI appropriate for that action while -inserting the C value into the appropriate place. Now, if -you ever change C<:PathPart('delete')> in your controller method to -C<:PathPart('kill')>, then your links will automatically update without -any changes to your .tt2 template file. +we have seen before. Here we use C<$c-Econtroller- +Eaction_for> to automatically generate a URI appropriate for that +action based on the method we want to link to while inserting the +C value into the appropriate place. Now, if you ever change +C<:PathPart('delete')> in your controller method to +C<:PathPart('kill')>, then your links will automatically update +without any changes to your .tt2 template file. As long as the name +of your method does not changed ("delete" here), then your links will +still be correct. There are a few shortcuts and options when using +C: + +=over 4 + +=item * + +If you are referring to a method in the current controller, you can +use C<$self-Eaction_for('_method_name_')>. + +=item * + +If you are referring to a method in a different controller, you need +to include that as an argument to C, as in +C<$c-Econtroller('_controller_name_')-Eaction_for('_method_name_')>. + +=back B You should use more than just a simple link with your applications. Consider using some sort of of confirmation page @@ -820,7 +839,8 @@ C method to match: # Set a status message to be displayed at the top of the view $c->stash->{status_msg} = "Book deleted."; - # Redirect the user back to the list page + # Redirect the user back to the list page. Note the use + # of $self->action_for as earlier in this section (BasicCRUD) $c->response->redirect($c->uri_for($self->action_for('list')); }