diff options
author | Clemens Kofler <clemens@railway.at> | 2008-09-13 13:53:18 +0200 |
---|---|---|
committer | Clemens Kofler <clemens@railway.at> | 2008-09-13 13:53:18 +0200 |
commit | 89e600a83f58de65f107837c64661ff23f284903 (patch) | |
tree | c5a8fa85d554eb0bc95c408cd409fe2cef06796c /railties/doc/guides/routing | |
parent | a8f4cd36b0f7d8f13a96a28da090a628b6187fa3 (diff) | |
parent | ae3dcd3de6da95a7c4ac2e9f99e5be812c4b9e45 (diff) | |
download | rails-89e600a83f58de65f107837c64661ff23f284903.tar.gz rails-89e600a83f58de65f107837c64661ff23f284903.tar.bz2 rails-89e600a83f58de65f107837c64661ff23f284903.zip |
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'railties/doc/guides/routing')
-rw-r--r-- | railties/doc/guides/routing/routing_outside_in.txt | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/railties/doc/guides/routing/routing_outside_in.txt b/railties/doc/guides/routing/routing_outside_in.txt index cd7f4c3b8e..34df2ecbaa 100644 --- a/railties/doc/guides/routing/routing_outside_in.txt +++ b/railties/doc/guides/routing/routing_outside_in.txt @@ -127,7 +127,7 @@ In Rails, a RESTful route provides a mapping between HTTP verbs, controller acti [source, ruby] ------------------------------------------------------- -map.resources photos +map.resources :photos ------------------------------------------------------- creates seven different routes in your application: @@ -174,7 +174,7 @@ You can also apply RESTful routing to singleton resources within your applicatio [source, ruby] ------------------------------------------------------- -map.resource geocoder +map.resource :geocoder ------------------------------------------------------- creates seven different routes in your application: @@ -220,7 +220,7 @@ The +:controller+ option lets you use a controller name that is different from t [source, ruby] ------------------------------------------------------- -map.resources photos, :controller => "images" +map.resources :photos, :controller => "images" ------------------------------------------------------- will recognize incoming URLs containing +photo+ but route the requests to the Images controller: @@ -257,7 +257,7 @@ You an use the +:requirements+ option in a RESTful route to impose a format on t [source, ruby] ------------------------------------------------------- -map.resources photos, :requirements => {:id => /[A-Z][A-Z][0-9]+/} +map.resources :photos, :requirements => {:id => /[A-Z][A-Z][0-9]+/} ------------------------------------------------------- This declaration constrains the +:id+ parameter to match the supplied regular expression. So, in this case, +/photos/1+ would no longer be recognized by this route, but +/photos/RR27+ would. @@ -272,7 +272,7 @@ The +:as+ option lets you override the normal naming for the actual generated pa [source, ruby] ------------------------------------------------------- -map.resources photos, :as => "images" +map.resources :photos, :as => "images" ------------------------------------------------------- will recognize incoming URLs containing +image+ but route the requests to the Photos controller: @@ -298,7 +298,7 @@ The +:path_names+ option lets you override the automatically-generated "new" and [source, ruby] ------------------------------------------------------- -map.resources photos, :path_names => { :new => 'make', :edit => 'change' } +map.resources :photos, :path_names => { :new => 'make', :edit => 'change' } ------------------------------------------------------- This would cause the routing to recognize URLs such as @@ -323,7 +323,7 @@ The +:path_prefix+ option lets you add additional parameters that will be prefix [source, ruby] ------------------------------------------------------- -map.resources photos, :path_prefix => '/photographers/:photographer_id' +map.resources :photos, :path_prefix => '/photographers/:photographer_id' ------------------------------------------------------- Routes recognized by this entry would include: @@ -341,8 +341,8 @@ You can use the :name_prefix option to avoid collisions between routes. This is [source, ruby] ------------------------------------------------------- -map.resources photos, :path_prefix => '/photographers/:photographer_id', :name_prefix => 'photographer_' -map.resources photos, :path_prefix => '/agencies/:agency_id', :name_prefix => 'agency_' +map.resources :photos, :path_prefix => '/photographers/:photographer_id', :name_prefix => 'photographer_' +map.resources :photos, :path_prefix => '/agencies/:agency_id', :name_prefix => 'agency_' ------------------------------------------------------- This combination will give you route helpers such as +photographer_photos_path+ and +agency_photo_edit_path+ to use in your code. |