Browse files

routing guide: fix typos and clarify code examples

  • Loading branch information...
1 parent 6e4e95b commit 04289172cb568b7f17eba93da79f158f3192edea @eparreno eparreno committed May 13, 2010
Showing with 9 additions and 3 deletions.
  1. +9 −3 railties/guides/source/routing.textile
12 railties/guides/source/routing.textile
@@ -119,6 +119,12 @@ h4. Singular Resources
Sometimes, you have a resource that clients always look up without referencing an ID. A common example, +/profile+ always shows the profile of the currently logged in user. In this case, you can use a singular resource to map +/profile+ (rather than +/profile/:id+) to the +show+ action.
+match "profile" => "users#show"
+This resourceful route
resource :geocoder
@@ -391,7 +397,7 @@ h4. The Query String
The +params+ will also include any parameters from the query string. For example, with this route:
-match ':controller/:action/:id
+match ':controller/:action/:id'
An incoming URL of +/photos/show/1?user_id=2+ will be dispatched to the +show+ action of the +Photos+ controller. +params+ will be <tt>{ :controller => "photos", :action => "show", :id => "1", :user_id => "2" }</tt>.
@@ -419,7 +425,7 @@ h4. Naming Routes
You can specify a name for any route using the +:as+ option.
-match 'logout' => 'sessions#destroy', :as => :logout
+match 'exit' => 'sessions#destroy', :as => :logout
This will create +logout_path+ and +logout_url+ as named helpers in your application. Calling +logout_path+ will return +/logout+
@@ -636,7 +642,7 @@ end
resources :photos
-This will provide route helpers such as +photographer_photos_path+.
+This will provide route helpers such as +admin_photos_path+, +new_admin_photo_path+ etc.
You could specify a name prefix to use for a group of routes in the scope:

0 comments on commit 0428917

Please sign in to comment.