Apply patch from Adrian Lai to clean up a few out of date bits in the tutorials
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Tutorial / BasicCRUD.pod
index 2e688bb..7da68dc 100644 (file)
@@ -97,7 +97,7 @@ Edit C<lib/MyApp/Controller/Books.pm> and enter the following method:
     
         # Call create() on the book model object. Pass the table 
         # columns/field values we want to set as hash values
-        my $book = $c->model('MyAppDB::Books')->create({
+        my $book = $c->model('DB::Books')->create({
                 title  => $title,
                 rating => $rating
             });
@@ -164,7 +164,7 @@ Edit C<root/src/books/create_done.tt2> and then enter:
     
     [% # Provide a link back to the list page                                    -%]
     [% # 'uri_for()' builds a full URI; e.g., 'http://localhost:3000/books/list' -%]
-    <p><a href="[% Catalyst.uri_for('/books/list') %]">Return to list</a></p>
+    <p><a href="[% c.uri_for('/books/list') %]">Return to list</a></p>
     
     [% # Try out the TT Dumper (for development only!) -%]
     <pre>
@@ -266,7 +266,7 @@ Open C<root/src/books/form_create.tt2> in your editor and enter:
 
     [% META title = 'Manual Form Book Create' -%]
     
-    <form method="post" action="[% Catalyst.uri_for('form_create_do') %]">
+    <form method="post" action="[% c.uri_for('form_create_do') %]">
     <table>
       <tr><td>Title:</td><td><input type="text" name="title"></td></tr>
       <tr><td>Rating:</td><td><input type="text" name="rating"></td></tr>
@@ -298,7 +298,7 @@ save the form information to the database:
         my $author_id = $c->request->params->{author_id} || '1';
     
         # Create the book
-        my $book = $c->model('MyAppDB::Books')->create({
+        my $book = $c->model('DB::Books')->create({
                 title   => $title,
                 rating  => $rating,
             });
@@ -380,7 +380,7 @@ and 2) the four lines for the Delete link near the bottom).
         </td>
         <td>
           [% # Add a link to delete a book %]
-          <a href="[% Catalyst.uri_for('delete/') _ book.id %]">Delete</a>
+          <a href="[% c.uri_for('delete', book.id) %]">Delete</a>
         </td>
       </tr>
     [% END -%]
@@ -406,7 +406,7 @@ following method:
         my ($self, $c, $id) = @_;
     
         # Search for the book and then delete it
-        $c->model('MyAppDB::Books')->search({id => $id})->delete_all;
+        $c->model('DB::Books')->search({id => $id})->delete_all;
     
         # Set a status message to be displayed at the top of the view
         $c->stash->{status_msg} = "Book deleted.";
@@ -479,7 +479,7 @@ C<sub delete> method to match:
         my ($self, $c, $id) = @_;
     
         # Search for the book and then delete it
-        $c->model('MyAppDB::Books')->search({id => $id})->delete_all;
+        $c->model('DB::Books')->search({id => $id})->delete_all;
     
         # Set a status message to be displayed at the top of the view
         $c->stash->{status_msg} = "Book deleted.";
@@ -521,7 +521,7 @@ C<sub delete> method to match the following:
         my ($self, $c, $id) = @_;
     
         # Search for the book and then delete it
-        $c->model('MyAppDB::Books')->search({id => $id})->delete_all;
+        $c->model('DB::Books')->search({id => $id})->delete_all;
     
         # Redirect the user back to the list page with status msg as an arg
         $c->response->redirect($c->uri_for('/books/list', 
@@ -536,7 +536,7 @@ query parameter:
     <div id="header">[% PROCESS site/header %]</div>
     
     <div id="content">
-    <span class="message">[% status_msg || Catalyst.request.params.status_msg %]</span>
+    <span class="message">[% status_msg || c.request.params.status_msg %]</span>
     <span class="error">[% error_msg %]</span>
     [% content %]
     </div>
@@ -569,6 +569,6 @@ Please report any errors, issues or suggestions to the author.  The
 most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
 
-Copyright 2006, Kennedy Clark, under Creative Commons License
+Copyright 2006-2008, Kennedy Clark, under Creative Commons License
 (L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).