Skip to content

Commit

Permalink
mention more details
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 11, 2015
1 parent ff76c8d commit 8b79e62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -372,7 +372,8 @@ route with all its children.
$r->get('/bye')
->to(namespace => 'MyApp::MyController::Foo::Bar', action => 'bye');

The C<controller> is always appended to this C<namespace> if available.
The C<controller> is always converted from C<snake_case> to C<CamelCase> with
L<Mojo::Util/"camelize">, and then appended to this C<namespace>.

# /bye -> MyApp::MyController::Foo::Bar->bye
$r->get('/bye')->to('foo-bar#bye', namespace => 'MyApp::MyController');
Expand All @@ -381,7 +382,9 @@ The C<controller> is always appended to this C<namespace> if available.
$r->get('/hey')->to('Foo::Bar#hey', namespace => 'MyApp::MyController');

You can also change the default namespaces for all routes in the application
with the router attribute L<Mojolicious::Routes/"namespaces">.
with the router attribute L<Mojolicious::Routes/"namespaces">, which usually
defaults to a namespace based on the application class (C<MyApp::Controller>),
as well as the bare application class (C<MyApp>).

$r->namespaces(['MyApp::MyController']);

Expand Down

0 comments on commit 8b79e62

Please sign in to comment.