aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2019-03-11 13:25:03 +0100
committerGitHub <noreply@github.com>2019-03-11 13:25:03 +0100
commit2440bef949fdb7ebdbe7cecdf2d56a99c5df25d1 (patch)
treef60b67e49c3b1d553870013cd7bd4f4ce9ec8b1f
parent50e01ec01a7658ba4542bb5f9b68223e98ce6180 (diff)
parent3b953d9698b7dd9c563b38ddeb92adfb15b44715 (diff)
downloadrails-2440bef949fdb7ebdbe7cecdf2d56a99c5df25d1.tar.gz
rails-2440bef949fdb7ebdbe7cecdf2d56a99c5df25d1.tar.bz2
rails-2440bef949fdb7ebdbe7cecdf2d56a99c5df25d1.zip
Merge pull request #35564 from prathamesh-sonpatki/expanded-routes-guide
Add example of the output of `rails routes --expanded` in the routing guide [ci skip]
-rw-r--r--guides/source/routing.md29
1 files changed, 28 insertions, 1 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md
index 9406a4bf0c..237ca56e1d 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -1190,6 +1190,33 @@ For example, here's a small section of the `rails routes` output for a RESTful r
edit_user GET /users/:id/edit(.:format) users#edit
```
+You can also use the `--expanded` option to turn on the expanded table formatting mode.
+
+```
+$ rails routes --expanded
+
+--[ Route 1 ]-----------------------------------------------------------------
+Prefix | users
+Verb | GET
+URI | /users(.:format)
+Controller#Action | users#index
+--[ Route 2 ]-----------------------------------------------------------------
+Prefix |
+Verb | POST
+URI | /users(.:format)
+Controller#Action | users#create
+--[ Route 3 ]-----------------------------------------------------------------
+Prefix | new_user
+Verb | GET
+URI | /users/new(.:format)
+Controller#Action | users#new
+--[ Route 4 ]-----------------------------------------------------------------
+Prefix | edit_user
+Verb | GET
+URI | /users/:id/edit(.:format)
+Controller#Action | users#edit
+```
+
You can search through your routes with the grep option: -g. This outputs any routes that partially match the URL helper method name, the HTTP verb, or the URL path.
```
@@ -1207,7 +1234,7 @@ $ rails routes -c Comments
$ rails routes -c Articles::CommentsController
```
-TIP: You'll find that the output from `rails routes` is much more readable if you widen your terminal window until the output lines don't wrap. You can also use --expanded option to turn on the expanded table formatting mode.
+TIP: You'll find that the output from `rails routes` is much more readable if you widen your terminal window until the output lines don't wrap.
### Testing Routes