Non-tech founder’s guide to choosing the right software development partner Download Ebook
Home>Blog>How to use routes in ruby on rails like a pro

How to use routes in Ruby on Rails like a pro

TIL (Today I Learned) that in Rails, you can filter routes by a specific controller or namespace using the rails routes command with the -c option.

For instance, if you want to filter routes by a specific controller, like UsersController, you can run:
rails routes -c UsersController
This command will display only the routes that are handled by the UsersController.

But hey, if you need to narrow it down even further by a specific namespace, Rails got your back! Just add the namespace followed by a double colon (::) after the -c option. For example, if your controller is within the Users namespace, you can use:

rails routes -c Users::
And voila! You'll see only the routes associated with the Users namespace. Handy, right? Now you can navigate through your routes like a boss! 🚀

Discover More Reads

Real Stories & Real Success

Do you have a tech idea?

Let’s talk!

By submitting this form, you agree with JetRockets’ Privacy Policy

If you prefer email, write to us at hello@jetrockets.com