diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index 15b26d8f9e..fda5c6c668 100644 --- a/railties/guides/source/routing.textile +++ b/railties/guides/source/routing.textile @@ -200,6 +200,16 @@ or, for a single case resources :posts, :path => "/admin/posts" +You can even set named parameters for the paths: + + +scope ":username" do + resources :posts +end + + +This will provide you with URLs such as +/bob/posts/1+ and will allow you to reference the +username+ part of the path as +params[:username]+ in controllers, helpers and views. + In each of these cases, the named routes remain the same as if you did not use +scope+. In the last case, the following paths map to +PostsController+: |_.HTTP Verb |_.Path |_.action |_.named helper |