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=f7f5f1b76371adf1d3cce17568a1ece5c8e1f074;hp=b747f66ad29730749edc848034c3f8aee8e019e6;hb=4768184b3b277399116fbd53cae3697a9767fee5;hpb=6d97b9733f7cd0679097c3e8fd970bf006e354b1 diff --git a/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod b/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod index b747f66..f7f5f1b 100644 --- a/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod +++ b/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod @@ -68,9 +68,9 @@ 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 -L, +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