aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/routing.textile
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-06-25 10:07:09 -0400
committerNeeraj Singh <neerajdotname@gmail.com>2010-06-25 10:07:09 -0400
commita2242a608e5c3057ec46ddffdd983d94780f90f6 (patch)
treef6a35a22fa2cadf99e9c27979f02437d28c4ff67 /railties/guides/source/routing.textile
parent0758d49300ea4c19c813ffd90854719379f6771c (diff)
downloadrails-a2242a608e5c3057ec46ddffdd983d94780f90f6.tar.gz
rails-a2242a608e5c3057ec46ddffdd983d94780f90f6.tar.bz2
rails-a2242a608e5c3057ec46ddffdd983d94780f90f6.zip
regexp anchors can't be in route constraints
Diffstat (limited to 'railties/guides/source/routing.textile')
-rw-r--r--railties/guides/source/routing.textile6
1 files changed, 6 insertions, 0 deletions
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}/
</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+.