Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pass parameters through stash, not action args
Action arguments aren't really meant to be arbitrary data, or at least we
are expecting them not to be.  The not found page wanted look at the
arguments and parameters, so it's easiest to let it keep doing that and
pass data between the actions using the stash.
  • Loading branch information
haarg committed Jul 21, 2017
1 parent 761a030 commit 91d85ef
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/MetaCPAN/Web/Controller/Release.pm
Expand Up @@ -16,7 +16,8 @@ sub root : Chained('/') PathPart('release') CaptureArgs(0) {
sub by_distribution : Chained('root') PathPart('') Args(1) {
my ( $self, $c, $distribution ) = @_;

$c->forward( 'view', [ $c->model->find($distribution) ] );
$c->stash( release_info => $c->model->find($distribution) );
$c->forward('view');
}

sub index : Chained('/') PathPart('release') CaptureArgs(1) {
Expand Down Expand Up @@ -44,12 +45,17 @@ sub by_author_and_release : Chained('root') PathPart('') Args(2) {
$c->detach();
}

$c->stash->{permalinks} = 1;
$c->forward( 'view', [ $c->model->get( $author, $release ) ] );
$c->stash(
permalinks => 1,
release_info => $c->model->get( $author, $release ),
);
$c->forward('view');
}

sub view : Private {
my ( $self, $c, $release_info ) = @_;
my ( $self, $c ) = @_;

my $release_info = $c->stash->{release_info};

my $data = $release_info->else(
sub {
Expand Down

0 comments on commit 91d85ef

Please sign in to comment.