Browse files

Routing guide: route constraints are anchored by default, remove ^ ch…

…aracter. [ci skip]
  • Loading branch information...
saulius committed May 29, 2012
1 parent 97fb1b6 commit 87ba0b48cd985b83c82cb82070b3d6ea83d029bd
Showing with 1 addition and 1 deletion.
  1. +1 −1 guides/source/routing.textile
@@ -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:
-get '/:id' => 'posts#show', :constraints => {:id => /^\d/}
+get '/:id' => 'posts#show', :constraints => {:id => /\d/}
However, note that you don't need to use anchors because all routes are anchored at the start.

0 comments on commit 87ba0b4

Please sign in to comment.