aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/routing.textile
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2010-07-03 09:18:02 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2010-07-03 09:18:02 +0100
commit547199ee4a279cf885ee6c4e3a605f64f70c9310 (patch)
treeb3280078a3951c44b90c32956538ef83fe9d39be /railties/guides/source/routing.textile
parent52e526a8e3ed3682ae2b774e4a328b9aa8bd6dde (diff)
downloadrails-547199ee4a279cf885ee6c4e3a605f64f70c9310.tar.gz
rails-547199ee4a279cf885ee6c4e3a605f64f70c9310.tar.bz2
rails-547199ee4a279cf885ee6c4e3a605f64f70c9310.zip
Updated routing guide to reflect the fact that :name_prefix is now :as
Diffstat (limited to 'railties/guides/source/routing.textile')
-rw-r--r--railties/guides/source/routing.textile14
1 files changed, 7 insertions, 7 deletions
diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile
index 3562030aa9..4e55b07ed7 100644
--- a/railties/guides/source/routing.textile
+++ b/railties/guides/source/routing.textile
@@ -647,11 +647,11 @@ end
h4. Overriding the Named Helper Prefix
-You can use the :name_prefix option to add a prefix to the named route helpers that Rails generates for a route. You can use this option to prevent collisions between routes using a path scope.
+You can use the :as option to rename the named route helpers that Rails generates for a route. You can use this option to prevent collisions between routes using a path scope.
<ruby>
scope "admin" do
- resources :photos, :name_prefix => "admin"
+ resources :photos, :as => "admin_photos"
end
resources :photos
@@ -662,14 +662,14 @@ This will provide route helpers such as +admin_photos_path+, +new_admin_photo_pa
You could specify a name prefix to use for a group of routes in the scope:
<ruby>
-scope "admin", :name_prefix => "admin" do
+scope "admin", :as => "admin" do
resources :photos, :accounts
end
resources :photos, :accounts
</ruby>
-NOTE: The +namespace+ scope will automatically add a +:name_prefix+ as well as +:module+ and +:path+ prefixes.
+NOTE: The +namespace+ scope will automatically add +:as+ as well as +:module+ and +:path+ prefixes.
h4. Restricting the Routes Created
@@ -722,13 +722,13 @@ ActiveSupport::Inflector.inflections do |inflect|
end
</ruby>
-h4(#nested-name-prefix). Using +:name_prefix+ in Nested Resources
+h4(#nested-names). Using +:as+ in Nested Resources
-The +:name_prefix+ option overrides the automatically-generated prefix for the parent resource in nested route helpers. For example,
+The +:as+ option overrides the automatically-generated name for the resource in nested route helpers. For example,
<ruby>
resources :magazines do
- resources :ads, :name_prefix => 'periodical'
+ resources :ads, :as => 'periodical_ads'
end
</ruby>