diff options
author | Florent Guilleux <florent2@gmail.com> | 2012-12-10 18:47:21 -0500 |
---|---|---|
committer | Florent Guilleux <florent2@gmail.com> | 2012-12-10 18:47:21 -0500 |
commit | 336bbb17e335323c0828165dd8f8f09b627664f1 (patch) | |
tree | 1d6cd3bff217873c549efbb5b149e7310efb4cbe | |
parent | d4d9e1f9bf2388a34dc6b7b9473ee14cda3166df (diff) | |
download | rails-336bbb17e335323c0828165dd8f8f09b627664f1.tar.gz rails-336bbb17e335323c0828165dd8f8f09b627664f1.tar.bz2 rails-336bbb17e335323c0828165dd8f8f09b627664f1.zip |
Document adding member route without the option
-rw-r--r-- | guides/source/routing.md | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md index 241a7cfec6..5bf31a1583 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -471,7 +471,7 @@ resources :photos do end ``` -This will recognize `/photos/1/preview` with GET, and route to the `preview` action of `PhotosController`. It will also create the `preview_photo_url` and `preview_photo_path` helpers. +This will recognize `/photos/1/preview` with GET, and route to the `preview` action of `PhotosController`, with the resource id value passed in `params[:id]`. It will also create the `preview_photo_url` and `preview_photo_path` helpers. Within the block of member routes, each route name specifies the HTTP verb that it will recognize. You can use `get`, `patch`, `put`, `post`, or `delete` here. If you don't have multiple `member` routes, you can also pass `:on` to a route, eliminating the block: @@ -481,6 +481,8 @@ resources :photos do end ``` +You can leave out the `:on` option, this will create the same member route except that the resource id value will be available in `params[:photo_id]` instead of `params[:id]`. + #### Adding Collection Routes To add a route to the collection: |