diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2012-09-28 23:17:07 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2012-09-28 23:17:07 +0530 |
commit | 955a72c692a4298d238cc2e6353b9874099203f1 (patch) | |
tree | 2a05fecd15526cd0013c22e45825be1aca4844d9 /guides/source/routing.md | |
parent | 77fbe1c0199567486c422fdf5cce49f2c11fc953 (diff) | |
parent | cf3e760b87c49470c9a26ab3e2da67602474be1f (diff) | |
download | rails-955a72c692a4298d238cc2e6353b9874099203f1.tar.gz rails-955a72c692a4298d238cc2e6353b9874099203f1.tar.bz2 rails-955a72c692a4298d238cc2e6353b9874099203f1.zip |
Merge branch 'master' of github.com:lifo/docrails
Conflicts:
actionpack/lib/action_view/helpers/asset_tag_helper.rb
Diffstat (limited to 'guides/source/routing.md')
-rw-r--r-- | guides/source/routing.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md index 27fd2a35c4..3acb7fa0e5 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -401,6 +401,18 @@ resources :photos do end ``` +#### Adding Routes for Additional New Actions + +To add an alternate new action using the `:on` shortcut: + +```ruby +resources :comments do + get 'preview', :on => :new +end +``` + +This will enable Rails to recognize paths such as `/comments/new/preview` with GET, and route to the `preview` action of `CommentsController`. It will also create the `preview_new_comment_url` and `preview_new_comment_path` route helpers. + #### A Note of Caution If you find yourself adding many extra actions to a resourceful route, it's time to stop and ask yourself whether you're disguising the presence of another resource. |