diff options
author | Mike Gunderloy <MikeG1@larkfarm.com> | 2008-09-26 20:35:10 -0500 |
---|---|---|
committer | Mike Gunderloy <MikeG1@larkfarm.com> | 2008-09-26 20:35:38 -0500 |
commit | df046298715b1927a832973c4c29955696fee02c (patch) | |
tree | 2a6e690062c26317b935490c50654072c9615fe6 /railties/doc | |
parent | 204e0653bd1ba5efb92026a30a0666bfd9b910cd (diff) | |
download | rails-df046298715b1927a832973c4c29955696fee02c.tar.gz rails-df046298715b1927a832973c4c29955696fee02c.tar.bz2 rails-df046298715b1927a832973c4c29955696fee02c.zip |
Fix substitution of path_prefix for name_prefix, some rewording.
Diffstat (limited to 'railties/doc')
-rw-r--r-- | railties/doc/guides/routing/routing_outside_in.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/doc/guides/routing/routing_outside_in.txt b/railties/doc/guides/routing/routing_outside_in.txt index fcd435ce66..c04319496e 100644 --- a/railties/doc/guides/routing/routing_outside_in.txt +++ b/railties/doc/guides/routing/routing_outside_in.txt @@ -537,8 +537,8 @@ It's possible to do some quite complex things by combining +:path_prefix+ and +: [source, ruby] ------------------------------------------------------- map.resources :photos, :path_prefix => 'admin', :controller => 'admin/photos' -map.resources :tags, :path_prefix => 'admin_photo_', :path_prefix => 'admin/photos/:photo_id', :controller => 'admin/photo_tags' -map.resources :ratings, :path_prefix => 'admin_photo_', :path_prefix => 'admin/photos/:photo_id', :controller => 'admin/photo_ratings' +map.resources :tags, :name_prefix => 'admin_photo_', :path_prefix => 'admin/photos/:photo_id', :controller => 'admin/photo_tags' +map.resources :ratings, :name_prefix => 'admin_photo_', :path_prefix => 'admin/photos/:photo_id', :controller => 'admin/photo_ratings' ------------------------------------------------------- The good news is that if you find yourself using this level of complexity, you can stop. Rails supports _namespaced resources_ to make placing resources in their own folder a snap. Here's the namespaced version of those same three routes: @@ -551,7 +551,7 @@ map.namespace(:admin) do |admin| end ------------------------------------------------------- -As you can see, the namespaced version is much more succinct than the one that spells everything out - but it still creates the same routes. For example, you'll get +admin_photos_url+ that expects to find an +Admin::PhotosController+ and that matches +admin/photos+, and +admin_photos_ratings+path+ that matches +/admin/photos/_photo_id_/ratings+, expecting to use +Admin::RatingsController+. +As you can see, the namespaced version is much more succinct than the one that spells everything out - but it still creates the same routes. For example, you'll get +admin_photos_url+ that expects to find an +Admin::PhotosController+ and that matches +admin/photos+, and +admin_photos_ratings+path+ that matches +/admin/photos/_photo_id_/ratings+, expecting to use +Admin::RatingsController+. Even though you're not specifying +path_prefix+ explicitly, the routing code will calculate the appropriate +path_prefix+ from the route nesting. === Adding More RESTful Actions |