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

Recent Projects

We take pride in creating applications that drive growth and evolution, from niche startups to international companies.

Let’s Build Something Great Together

Let’s discuss your project and see how Ruby on Rails can be your competitive advantage.

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