aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2011-02-14 00:40:53 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2011-02-14 01:01:20 +0000
commitfd7605826a6e4f7590e4abf42c6c9d0923afc4ef (patch)
tree050282052ae4fdf2154f7a428e81f826652273c9 /railties/guides/source
parent48fe62ee571002bdee694a5722285d4055a5e695 (diff)
downloadrails-fd7605826a6e4f7590e4abf42c6c9d0923afc4ef.tar.gz
rails-fd7605826a6e4f7590e4abf42c6c9d0923afc4ef.tar.bz2
rails-fd7605826a6e4f7590e4abf42c6c9d0923afc4ef.zip
Add notes on how to override the default :id constraint [#5994 state:resolved]
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/routing.textile4
1 files changed, 4 insertions, 0 deletions
diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile
index 28a207c436..d214031b31 100644
--- a/railties/guides/source/routing.textile
+++ b/railties/guides/source/routing.textile
@@ -391,6 +391,8 @@ NOTE: You can't use +namespace+ or +:module+ with a +:controller+ path segment.
match ':controller(/:action(/:id))', :controller => /admin\/[^\/]+/
</ruby>
+TIP: By default dynamic segments don't accept dots - this is because the dot is used as a separator for formatted routes. If you need to use a dot within a dynamic segment add a constraint which overrides this - for example +:id => /[^\/]+/+ allows anything except a slash.
+
h4. Static Segments
You can specify static segments when creating a route:
@@ -646,6 +648,8 @@ end
NOTE: Of course, you can use the more advanced constraints available in non-resourceful routes in this context.
+TIP: By default the +:id+ parameter doesn't accept dots - this is because the dot is used as a separator for formatted routes. If you need to use a dot within an +:id+ add a constraint which overrides this - for example +:id => /[^\/]+/+ allows anything except a slash.
+
h4. Overriding the Named Helpers
The +:as+ option lets you override the normal naming for the named route helpers. For example: