Ruby on Rails Tip: Simplifying Route Searches

Gonzalo Galdámez
Unagi
Published in
Feb 9, 2024
Ruby on Rails — 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.

Unagi provides software development services in #Ruby, a stack we still choose after +11 years. Check out more about us.

--

--