[Catalyst] Minor Problem With Tutorial
Nilson Santos Figueiredo Junior
acid06 at gmail.com
Mon Aug 14 20:57:25 CEST 2006
On 8/14/06, Kevin Monceaux <Kevin at rawfeddogs.net> wrote:
> Anyway, I'm at the end of the BasicCRUD section of the tutorial where one
> creates the Books::Delete method. The last line in the method is:
>
> $c->forward('list');
>
> Catalyst appears to be ignoring this statement. When I tried to delete a
> book I got:
>
> Coldn't render template "file error - books/delete.tt2: not found"
>
> So, I tried creating an empty books/delete.tt2 template to see if Catalyst
> just wanted to find a template file matching the method it was in before
> performing the redirect. It then displayed the blank page instead of
> redirecting to the list method. I'm sure there is something simple I
> overlooked.
This might seem a little bit non-intuitive when you're just a beginner
at Catalyst, but $c->forward('list') won't cause Catalyst to render
your books/list.tt2 template. It will execute the 'list' action and
return, getting back to your books/delete.tt2 template.
In order to achieve the desired behaviour you could either issue a
redirect response (through $c->response->redirect($uri) ) or
explicitely set the desired template filename.
-Nilson Santos F. Jr.
More information about the Catalyst
mailing list