From a2242a608e5c3057ec46ddffdd983d94780f90f6 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Fri, 25 Jun 2010 10:07:09 -0400 Subject: regexp anchors can't be in route constraints --- railties/guides/source/routing.textile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'railties/guides') diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index 3f6bb66ee5..fe0e2f7d40 100644 --- a/railties/guides/source/routing.textile +++ b/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}/ ++:constraints+ takes regular expression. However note that regexp anchors can't be used within constraints. For example following route will not work: + + +match '/:id' => 'videos#show', :constraints => {:id => /^\d/} + + h4. Request-Based Constraints You can also constrain a route based on any method on the Request object that returns a +String+. -- cgit v1.2.3