This blog is part of our Rails 5 series.
rails routes shows all the routes
in the application.
This list can be lengthy and
it could be difficult to locate
exactly what user is looking for.
Ways to search specific routes prior to Rails 5
To see only specific routes
we can use commands like
Options with Rails 5
to perform pattern matching on routes.
Controller specific search
-c to search for routes related to controller.
Also remember that Rails does case insensitive search.
rails routes -c users is same as
rails routes -c Users.
Pattern specific search
-g option to do
pattern matching. This results in
any routes that partially matches Prefix, Controller#Action or the URI pattern.
using CONTROLLER=some_controller has now been deprecated.
This had the same effect as searching
for a controller specific route.