Ruby on Rails Tip: Simplifying Route Searches

Did you know Ruby on Rails provides a couple of parameters for rails routes that will maximize your productivity? Let’s see how it works.

Grep through Rails Routes

You can grep through Rails routes with the `-g` option, particularly useful when dealing with large and complex route configurations.

rails routes -g

Filter routes based on a specified controller

There is also a `-c` command to display the routes that are specifically related to the actions and resources for the specified controller.

rails routes -c

Note that in the last example, the route stocks_product is not listed as it belongs to the ProductsController.