diff options
Diffstat (limited to 'railties/guides/source/routing.textile')
-rw-r--r-- | railties/guides/source/routing.textile | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index 0cf8c45761..cf71e700dc 100644 --- a/railties/guides/source/routing.textile +++ b/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: + +<ruby> +scope(:resources_path_names => { :new => "neu", :edit => "bearbeiten" }) do + resources :categories, :path => "kategorien" +end +</ruby> + +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":http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/3 -* 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":http://www.rizwanreza.com/ * 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 |