diff options
author | Ryan Garver <ragarver@gmail.com> | 2012-10-02 10:37:27 -0700 |
---|---|---|
committer | Ryan Garver <ragarver@gmail.com> | 2012-10-02 10:37:27 -0700 |
commit | 4cb50a3f571234b1202f9a0dffe39b445ecf807d (patch) | |
tree | 13780082c3974bc480cf35722cabf8788beed3ab /guides/source/routing.md | |
parent | 3fdb7126110caad3f3db4c2b44ffc365b51c34eb (diff) | |
parent | df08271f9c044b7614d70baf4b818f1a79f4a6e1 (diff) | |
download | rails-4cb50a3f571234b1202f9a0dffe39b445ecf807d.tar.gz rails-4cb50a3f571234b1202f9a0dffe39b445ecf807d.tar.bz2 rails-4cb50a3f571234b1202f9a0dffe39b445ecf807d.zip |
Merge branch 'master' into feature/public-fragment_name_with_digest
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. |