aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/routing.md
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2016-01-25 01:32:44 +0530
committerVipul A M <vipulnsward@gmail.com>2016-02-02 00:27:30 +0530
commit8a436fdd98c63cc0a7a6d2c642c18d33421dc6ad (patch)
tree07bd88344185093d8a692cbd6606afa4eb50d372 /guides/source/routing.md
parent25a42755403ba4a8d9a4128d5ff6483ca2fd9252 (diff)
downloadrails-8a436fdd98c63cc0a7a6d2c642c18d33421dc6ad.tar.gz
rails-8a436fdd98c63cc0a7a6d2c642c18d33421dc6ad.tar.bz2
rails-8a436fdd98c63cc0a7a6d2c642c18d33421dc6ad.zip
Add options for rake routes task
Add two options: `-c` and `-g`. `-g` option returns the urls name, verb and path fields that match the pattern. `-c` option returns the urls for specific controller. Fixes #18902, and Fixes #20420 [Anton Davydov & Vipul A M]
Diffstat (limited to 'guides/source/routing.md')
-rw-r--r--guides/source/routing.md17
1 files changed, 14 insertions, 3 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md
index 5a745b10cd..d9e64d56ac 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -1136,10 +1136,21 @@ 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 may restrict the listing to the routes that map to a particular controller setting the `CONTROLLER` environment variable:
+You can search through your routes with the --grep option (-g for short). This outputs any routes that partially match the URL helper method name, the HTTP verb, or the URL path.
-```bash
-$ CONTROLLER=users bin/rails routes
+```
+$ bin/rake routes --grep new_comment
+$ bin/rake routes -g POST
+$ bin/rake routes -g admin
+```
+
+If you only want to see the routes that map to a specific controller, there's the --controller option (-c for short).
+
+```
+$ bin/rake routes --controller users
+$ bin/rake routes --controller admin/users
+$ bin/rake routes -c Comments
+$ bin/rake 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.