Skip to content

Commit

Permalink
added camel case controller examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 10, 2012
1 parent 1358146 commit 2d39c62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@

3.46 2012-10-11
- Improved router and renderer to allow camel case controllers.
- Improved documentation.

3.45 2012-10-10
- Added multi_accept attribute to Mojo::IOLoop.
Expand Down
9 changes: 6 additions & 3 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -303,12 +303,15 @@ route with all its children.

# /bye -> MyApp::Controller::Foo->bye
$r->route('/bye')
->to(namespace => 'MyApp::Controller::Foo', action => 'bye');
->to(namespace => 'MyApp::Controller::Foo::Bar', action => 'bye');

The C<controller> is always appended to the C<namespace> if available.

# /bye -> MyApp::Controller::Foo->bye
$r->route('/bye')->to('foo#bye', namespace => 'MyApp::Controller');
# /bye -> MyApp::Controller::Foo::Bar->bye
$r->route('/bye')->to('foo-bar#bye', namespace => 'MyApp::Controller');

# /hey -> MyApp::Controller::Foo::Bar->hey
$r->route('/hey')->to('Foo::Bar#hey', namespace => 'MyApp::Controller');

You can also change the default namespace for all routes in the application
with the router attribute L<Mojolicious::Routes/"namespace">.
Expand Down

0 comments on commit 2d39c62

Please sign in to comment.