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=78db7977ea545b15403545d9aa5eac54492dd940;hp=0aa7e2ce96f591088d783bb75291838e369d16b3;hb=b2ad8bbdd933100eccb9a5f61bfefc3b81e4371b;hpb=994b66ad3ec2a66fb5d22957474229422b9ce110 diff --git a/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod b/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod index 0aa7e2c..78db797 100644 --- a/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod +++ b/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod @@ -620,7 +620,7 @@ and 2) the four lines for the Delete link near the bottom). [% # Add a link to delete a book %] - Delete + Delete [% END -%] @@ -630,6 +630,14 @@ The additional code is obviously designed to add a new column to the 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. + B You should use more than just a simple link with your applications. Consider using some sort of of confirmation page (typically with unique actions in your controller for both the @@ -806,7 +814,7 @@ C method to match: $c->stash->{status_msg} = "Book deleted."; # Redirect the user back to the list page - $c->response->redirect($c->uri_for('/books/list')); + $c->response->redirect($c->uri_for($c->controller->action_for('list')); } @@ -848,7 +856,7 @@ method to match the following: $c->stash->{object}->delete; # Redirect the user back to the list page with status msg as an arg - $c->response->redirect($c->uri_for('/books/list', + $c->response->redirect($c->uri_for($c->controller->action_for('list'), {status_msg => "Book deleted."})); }