提交 87ba0b48 编写于 作者: S Saulius Grigaliunas

Routing guide: route constraints are anchored by default, remove ^ character. [ci skip]

上级 97fb1b6e
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册