Permalink
Browse files

regexp anchors can't be in route constraints

  • Loading branch information...
1 parent 0758d49 commit a2242a608e5c3057ec46ddffdd983d94780f90f6 Neeraj Singh committed Jun 25, 2010
Showing with 6 additions and 0 deletions.
  1. +6 −0 railties/guides/source/routing.textile
View
6 railties/guides/source/routing.textile
@@ -444,6 +444,12 @@ This route would match URLs such as +/photo/A12345+. You can more succinctly exp
match 'photo/:id' => 'photos#show', :id => /[A-Z]\d{5}/
</ruby>
++:constraints+ takes regular expression. However note that regexp anchors can't be used within constraints. For example following route will not work:
+
+<ruby>
+match '/:id' => 'videos#show', :constraints => {:id => /^\d/}
+</ruby>
+
h4. Request-Based Constraints
You can also constrain a route based on any method on the <a href="action_controller_overview.html#the-request-object">Request</a> object that returns a +String+.

0 comments on commit a2242a6

Please sign in to comment.