diff options
author | eparreno <emili@eparreno.com> | 2010-05-13 16:12:25 +0200 |
---|---|---|
committer | eparreno <emili@eparreno.com> | 2010-05-13 16:12:25 +0200 |
commit | 04289172cb568b7f17eba93da79f158f3192edea (patch) | |
tree | 81431a7ef2612cce2df8a708e42f982bf4043200 /railties/guides/source/routing.textile | |
parent | 6e4e95b7f9c163213dd4b5d92b2f4f3b17a3d1f3 (diff) | |
download | rails-04289172cb568b7f17eba93da79f158f3192edea.tar.gz rails-04289172cb568b7f17eba93da79f158f3192edea.tar.bz2 rails-04289172cb568b7f17eba93da79f158f3192edea.zip |
routing guide: fix typos and clarify code examples
Diffstat (limited to 'railties/guides/source/routing.textile')
-rw-r--r-- | railties/guides/source/routing.textile | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index 7ac5bc8d3a..2bc1736137 100644 --- a/railties/guides/source/routing.textile +++ b/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. <ruby> +match "profile" => "users#show" +</ruby> + +This resourceful route + +<ruby> resource :geocoder </ruby> @@ -391,7 +397,7 @@ h4. The Query String The +params+ will also include any parameters from the query string. For example, with this route: <ruby> -match ':controller/:action/:id +match ':controller/:action/:id' </ruby> 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. <ruby> -match 'logout' => 'sessions#destroy', :as => :logout +match 'exit' => 'sessions#destroy', :as => :logout </ruby> 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 </ruby> -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: |