Permalink
Browse files

use implicit route names in redirects

  • Loading branch information...
tempire committed Aug 4, 2012
1 parent 2b37699 commit 0159fcfa6b2e59b19c58b0d1b849f0802e8ccf96
Showing with 9 additions and 9 deletions.
  1. +2 −2 lib/MojoFull/Blogs.pm
  2. +2 −2 lib/MojoFull/Photos.pm
  3. +5 −5 mojolite
  4. BIN test.db
View
@@ -9,7 +9,7 @@ sub index {
|| qw/personal/;
my @blogs = $self->db->resultset('Blog')->by_tags(@tags)
- or return $self->redirect_to('/blogs');
+ or return $self->redirect_to('blogs');
$self->render('blogs/index', blogs => [@blogs],);
}
@@ -19,7 +19,7 @@ sub show {
my $param = $self->stash('name');
my $blog = $self->db->resultset('Blog')->by_id_or_name($param)
- or return $self->redirect_to('/blogs');
+ or return $self->redirect_to('blogs');
$self->render('blogs/show', blog => $blog);
}
View
@@ -16,7 +16,7 @@ sub show {
my $id = $self->param('id');
my $photo = $self->db->resultset('Photo')->find($id)
- or $self->redirect_to("/photos"), return;
+ or $self->redirect_to('photos'), return;
$self->render(template => 'photos/show', photo => $photo);
}
@@ -26,7 +26,7 @@ sub show_set {
my $id = $self->param('id');
my $set = $self->db->resultset('Photoset')->by_id_or_name($id)
- or $self->redirect_to("/photos"), return;
+ or $self->redirect_to('photos'), return;
$self->render(template => 'photos/show_set', set => $set);
}
View
@@ -22,7 +22,7 @@ get '/' => sub {
};
get '/blogs' => sub {
- shift->redirect_to('/blogs/tag/personal');
+ shift->redirect_to(blogstagtags => tags => 'personal');
};
get '/blogs/tag/(*tags)' => sub {
@@ -32,7 +32,7 @@ get '/blogs/tag/(*tags)' => sub {
my @tags = grep $_ ne 'tag' => split '/' => $self->param('tags');
my @blogs = $self->db->resultset('Blog')->by_tags(@tags)
- or return $self->redirect_to('/blogs');
+ or return $self->redirect_to('blogs');
$self->render('blogs/index', blogs => [@blogs],);
};
@@ -42,7 +42,7 @@ get '/blogs/(:name)' => sub {
my $param = $self->stash('name');
my $blog = $self->db->resultset('Blog')->by_id_or_name($param)
- or return $self->redirect_to('/blogs');
+ or return $self->redirect_to('blogs');
$self->render('blogs/show', blog => $blog);
};
@@ -62,7 +62,7 @@ get '/photos/:id' => (photoset => '') => sub {
my $id = $self->param('id');
my $set = $self->db->resultset('Photoset')->by_id_or_name($id)
- or $self->redirect_to("/photos"), return;
+ or $self->redirect_to('photos'), return;
$self->render(template => 'photos/show_set', set => $set);
};
@@ -72,7 +72,7 @@ get '/photos/:id' => sub {
my $id = $self->param('id');
my $photo = $self->db->resultset('Photo')->find($id)
- or $self->redirect_to("/photos"), return;
+ or $self->redirect_to('photos'), return;
$self->render(template => 'photos/show', photo => $photo);
};
View
BIN test.db
Binary file not shown.

0 comments on commit 0159fcf

Please sign in to comment.