X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAction%2FREST.pm;h=04454223f1de990aec7730b197bae58c7c99420c;hb=3c4306f26628d82044c933aa391c346440fdfcdf;hp=a91beac09f80fd1873b061228a93431a82b211e1;hpb=40de934ce925aa9fbf1d2fa15846b5c0de9ec790;p=catagits%2FCatalyst-Action-Serialize-Data-Serializer.git diff --git a/lib/Catalyst/Action/REST.pm b/lib/Catalyst/Action/REST.pm index a91beac..0445422 100644 --- a/lib/Catalyst/Action/REST.pm +++ b/lib/Catalyst/Action/REST.pm @@ -99,14 +99,14 @@ sub _dispatch_rest_method { my ($code, $name); + # Execute normal 'foo' action. + $c->execute( $self->class, $self, @{ $c->req->args } ); + # Common case, for foo_GET etc if ( $code = $controller->action_for($rest_method) ) { - $c->execute( $self->class, $self, @{ $c->req->args } ); # Execute normal 'foo' action. return $c->forward( $code, $c->req->args ); # Forward to foo_GET if it's an action } elsif ($code = $controller->can($rest_method)) { - # Execute normal action - $c->execute( $self->class, $self, @{ $c->req->args } ); $name = $rest_method; # Stash name and code to run 'foo_GET' like an action below. } @@ -127,8 +127,11 @@ sub _dispatch_rest_method { # localise stuff so we can dispatch the action 'as normal, but get # different stats shown, and different code run. + # Also get the full path for the action, and make it look like a forward local $self->{code} = $code; - local $self->{reverse} = $name; + my @name = split m{/}, $self->reverse; + $name[-1] = $name; + local $self->{reverse} = "-> " . join('/', @name); $c->execute( $self->class, $self, @{ $c->req->args } ); }