Skip to content

Commit

Permalink
Routing guide: route constraints are anchored by default, remove ^ ch…
Browse files Browse the repository at this point in the history
…aracter. [ci skip]
  • Loading branch information
saulius committed May 29, 2012
1 parent 97fb1b6 commit 87ba0b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion guides/source/routing.textile
Expand Up @@ -486,7 +486,7 @@ get 'photos/:id' => 'photos#show', :id => /[A-Z]\d{5}/
+:constraints+ takes regular expressions with the restriction that regexp anchors can't be used. For example, the following route will not work:

<ruby>
get '/:id' => 'posts#show', :constraints => {:id => /^\d/}
get '/:id' => 'posts#show', :constraints => {:id => /\d/}
</ruby>

However, note that you don't need to use anchors because all routes are anchored at the start.
Expand Down

0 comments on commit 87ba0b4

Please sign in to comment.