Very quick tip: Grepping rails routes.

As you probably know, rake routes (also rails routes in rails 5) prints a list of all routes in your application - simple enough. As a project grows however, the routes.rb file can get pretty large fairly quickly. This can make finding the actual route you are looking for tough, especially after adding a few engines.

The fix:

rake routes | grep KEYWORD

This will filter the output of the lines to match your keyword.

To return all routes related to a controller, simply add the name of the controller:

rake routes | grep users

To return all routes with a specific HTTP Verb, simply add GET, POST, PATCH:

rake routes | grep GET

To return all routes related to an action:

rake routes | grep update

Super simple, but I find it really useful.

Written on February 7, 2016