diff options
author | Mike Gunderloy <MikeG1@larkfarm.com> | 2008-09-18 11:06:57 -0500 |
---|---|---|
committer | Mike Gunderloy <MikeG1@larkfarm.com> | 2008-09-18 11:07:12 -0500 |
commit | dc996ca971afb260ff470586e07f62446f6a23ef (patch) | |
tree | b555cc055f623b6784412b31801215052892093c | |
parent | 03968ef5beb625cc9ca63921d633f5e7c3ec847b (diff) | |
download | rails-dc996ca971afb260ff470586e07f62446f6a23ef.tar.gz rails-dc996ca971afb260ff470586e07f62446f6a23ef.tar.bz2 rails-dc996ca971afb260ff470586e07f62446f6a23ef.zip |
Added a small section on defining multiple resources on a single line.
-rw-r--r-- | railties/doc/guides/routing/routing_outside_in.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/railties/doc/guides/routing/routing_outside_in.txt b/railties/doc/guides/routing/routing_outside_in.txt index 185b4ab2cc..29b69ab47d 100644 --- a/railties/doc/guides/routing/routing_outside_in.txt +++ b/railties/doc/guides/routing/routing_outside_in.txt @@ -168,6 +168,24 @@ photos_url # => "http://www.example.com/photos" photos_path # => "/photos" ------------------------------------------------------- +=== Defining Multiple Resources at the Same Time + +If you need to create routes for more than one RESTful resource, you can save a bit of typing by defining them all with a single call to +map.resources+: + +[source, ruby] +------------------------------------------------------- +map.resources :photos, :books, :videos +------------------------------------------------------- + +This has exactly the same effect as + +[source, ruby] +------------------------------------------------------- +map.resources :photos +map.resources :books +map.resources :videos +------------------------------------------------------- + === Singular Resources You can also apply RESTful routing to singleton resources within your application. In this case, you use +map.resource+ instead of +map.resources+ and the route generation is slightly different. For example, a routing entry of |