On Fri, Jan 8, 2010 at 9:55 AM, Tomas Doran <bobtf...@bobtfish.net> wrote:

>
>>
>> $c->response->redirect($c->uri_for("/user/$user_id/blog/$blog_id/entry/list"));
>>
>
> Eww, don't do that.
>

I know, I held my nose when doing that, but in point of fact, it does work,
so in a pinch....

>
> You want
> $c->response->redirect($c->uri_for_action('/user/blog/entry/list',
> [$user_id, $blog_id]));
>

For some unknown reason, I was never able to get the redirect formatting
worked out, so I resorted to smelly workarounds. That works nicely, thank
you.


>
>> But I can't seem to _go_ to the list (this doesn't work -- I get 'invalid
>> ID'):
>> $c->go( 'My::Controller::User::Blog::Entry', 'list', [ \...@captures, 
>> \...@args
>> ] );
>>
>
> Not specific enough. You get 'invalid ID' where, from what?
>

My bad, sorry, that's from a debug message *somebody* coded into my app
(sigh).

>
> Please show use the debug table from app startup and for the hit in
> question which has the issue?


> At a guess what you're doing wrong is not ->go ing to the end of the chain
> - you can _only_ go to chain endpoints (rather than individual actions) as
> go does a full redispatch.
>
> Actually, I am trying to go to the end of chain:

| /user/*/blog/*/entry/list | /user/base (0)               |
|                           | -> /user/id (1)              |
|                           | -> /user/blog/base (0)       |
|                           | -> /user/blog/id (1)         |
|                           | -> /user/blog/entry/base (0) |
|                           | => /user/blog/entry/list     |


But likely I don't have the go formatting correct. He's not picking up the
user id:

.--------------------------------
| Action
+--------------------------------
| /auto
| /user/base
| /user/id
| /user/blog/base
| /user/blog/id
| /user/blog/entry/base
| /user/blog/entry/add
|  -> /user/blog/entry/save
|   /auto
|   /user/base
|   /user/id
|    -> /user/not_found
|     -> /user/list
| /end
|  -> Blog::View::TT->process

I've tried various incarnations of go, but here's one:

    my @args = qw( $user_id  $blog_id );
    my @captures = $c->req->captures;

    $c->go( 'Blog::Controller::User::Blog::Entry', 'list', [ \...@captures,
\...@args ] );

I also tried with my @captures = (), @captures =  qw( $user_id  $blog_id );

I don't see go yet.

/dennis
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to