Last active
February 1, 2016 13:52
-
-
Save leejo/8fc1712f34120838570c to your computer and use it in GitHub Desktop.
Route ordering change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We have two routes, defined in this order: | |
``` | |
$r->route('/cause/:cause_id/campaigns/:type/:paginate/:page/', | |
type=>[qw(active archived)], | |
paginate => [qw(page)], | |
cause_id => qr/\d+/, | |
page => qr/\d+/) | |
->to( | |
paginate => [qw(page)])->to( | |
controller => 'Public::Cause', | |
action => 'campaigns', | |
paginate => 'page', | |
page => 1, | |
type => 'active' | |
); | |
$r->route('/cause/:cause_id/campaigns/:campaign_id/', | |
cause_id => qr/\d+/, | |
campaign_id => qr/\d+/) | |
->to( | |
controller => 'Public::Cause', | |
action => 'campaign' | |
); | |
``` | |
With https://github.com/kraih/mojo/commit/c9b65981e8e64ed3e3c82d6fa8b8872f79ff3d8e#diff-2650135fc08c671d8b875d9b8480f498 | |
the second route now doesn't get hit as the first route will now match. Is this expected behaviour? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The test:
Output pre c9b65981e8e64ed3e3c82d6fa8b8872f79ff3d8e (Notice the different "Routing to controller" log entry):
Output post c9b65981e8e64ed3e3c82d6fa8b8872f79ff3d8e:
The only change between the pre and post test run is this: