X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F04_BasicCRUD.pod;h=490eb742bf3c64b2a09dfae6e325f630d2ab20d4;hp=09af3ca4a93399ed5ed1c649f8e193934f1a4098;hb=a608d8ce868536757adabcd074dc4a458339299a;hpb=d7db91560b47fd204b151daf7cfe5f52c3b089f6 diff --git a/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod b/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod index 09af3ca..490eb74 100644 --- a/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod +++ b/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod @@ -68,8 +68,8 @@ functionality, will be addressed in Chapter 9. Although this chapter of the tutorial will show you how to build CRUD functionality yourself, another option is to use a "CRUD builder" type -of tool to automate the process. You get less control, but it's quick -and easy. For example, see +of tool to automate the process. You get less control, but it can be +quick and easy. For example, see L, L, and L. @@ -96,7 +96,7 @@ Edit C and enter the following method: =cut - sub url_create : Local { + sub url_create :Local { # In addition to self & context, get the title, rating, & # author_id args from the URL. Note that Catalyst automatically # puts extra information after the "// and enter the following method: # Note: Above is a shortcut for this: # $book->create_related('book_authors', {author_id => $author_id}); - # Assign the Book object to the stash for display in the view - $c->stash->{book} = $book; - - # Set the TT template to use - $c->stash->{template} = 'books/create_done.tt2'; + # Assign the Book object to the stash for display and set template + $c->stash(book => $book, + template => 'books/create_done.tt2'); } Notice that Catalyst takes "extra slash-separated information" from the @@ -183,31 +181,23 @@ outputs the "last name for the first author" above to match this: to get around an issue in TT v2.15 where blessed hash objects were not handled correctly. But, if you are still using v2.15, it's probably -time to upgrade (v2.15 is exactly 3 years old on the day I'm typing -this). If you are following along in Debian, then you should be on at -least v2.20. You can test your version of Template Toolkit with the -following: +time to upgrade (v2.15 is almost 4 years old). If you are following +along in Debian, then you should be on at least v2.20. You can test +your version of Template Toolkit with the following: perl -MTemplate -e 'print "$Template::VERSION\n"' =head2 Try the 'url_create' Feature -If the application is still running from before, use C to kill -it. Then restart the server: +Make sure the development server is running with the "-r" restart +option: - $ DBIC_TRACE=1 script/myapp_server.pl + $ DBIC_TRACE=1 script/myapp_server.pl -r Note that new path for C appears in the startup debug output. -B: You can use C