Skip to content
This repository
Browse code

regexp anchors can't be in route constraints

  • Loading branch information...
commit a2242a608e5c3057ec46ddffdd983d94780f90f6 1 parent 0758d49
Neeraj Singh neerajdotname authored

Showing 1 changed file with 6 additions and 0 deletions. Show diff stats Hide diff stats

  1. +6 0 railties/guides/source/routing.textile
6 railties/guides/source/routing.textile
Source Rendered
@@ -444,6 +444,12 @@ This route would match URLs such as +/photo/A12345+. You can more succinctly exp
444 444 match 'photo/:id' => 'photos#show', :id => /[A-Z]\d{5}/
445 445 </ruby>
446 446
  447 ++:constraints+ takes regular expression. However note that regexp anchors can't be used within constraints. For example following route will not work:
  448 +
  449 +<ruby>
  450 +match '/:id' => 'videos#show', :constraints => {:id => /^\d/}
  451 +</ruby>
  452 +
447 453 h4. Request-Based Constraints
448 454
449 455 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.
Something went wrong with that request. Please try again.