Browse files

Routes Guide: Added Section on customizing path names for resources.

  • Loading branch information...
1 parent a0e4bb9 commit f5c54bce20933b6d48dd9f41b49839302c1335f7 @rizwanreza rizwanreza committed Apr 5, 2010
Showing with 22 additions and 1 deletion.
  1. +22 −1 railties/guides/source/routing.textile
@@ -364,6 +364,27 @@ In this case, all of the normal routes except the route for +destroy+ (a +DELETE
TIP: If your application has many RESTful routes, using +:only+ and +:except+ to generate only the routes that you actually need can cut down on memory use and speed up the routing process.
+h5. Changing Path Names for Resources
+Using +scope+, we can alter path names generated by resources:
+scope(:resources_path_names => { :new => "neu", :edit => "bearbeiten" }) do
+ resources :categories, :path => "kategorien"
+With +scope+ defined, it now generates routes with customized path names.
+|_.HTTP verb|_.URL |_.controller |_.action |_:used for|
+|GET |/kategorien |Categories |index |display a list of all categories|
+|GET |/kategorien/neu |Categories |new |return an HTML form for creating a new category|
+|POST |/kategorien |Categories |create |create a new category|
+|GET |/kategorien/1 |Categories |show |display a specific category|
+|GET |/kategorien/:id/bearbeiten |Categories |edit |return an HTML form for editing a category|
+|PUT |/kategorien/1 |Categories |update |update a specific category|
+|DELETE |/kategorien/1 |Categories |destroy |delete a specific category|
h4. Nested Resources
It's common to have resources that are logically children of other resources. For example, suppose your application includes these models:
@@ -809,7 +830,7 @@ h3. Changelog
"Lighthouse ticket":
-* April 2, 2010: Updated guide to match new Routing DSL in Rails 3, by Rizwan Reza
+* April 2, 2010: Updated guide to match new Routing DSL in Rails 3, by "Rizwan Reza":
* Febuary 1, 2010: Modifies the routing documentation to match new routing DSL in Rails 3, by Prem Sichanugrist
* October 4, 2008: Added additional detail on specifying verbs for resource member/collection routes, by "Mike Gunderloy":credits.html#mgunderloy
* September 23, 2008: Added section on namespaced controllers and routing, by "Mike Gunderloy":credits.html#mgunderloy

0 comments on commit f5c54bc

Please sign in to comment.