Sometimes, when you are working with a large codebase, your
routes.rb files grow really fast and become very dirty.
There are several things that make your routes file bigger:
- Customization of devise;
- Specific gems that mount additional routes (Active Admin, ActionCable);
- Sidekiq + SidekiqWeb + Basic authentication;
- Namespaces with APP or API.
All these points lead to one fact - your file grows and it is getting hard to maintain it.
However, do you need all this staff in regular work, when you add some controller with another resource? My answer is No!
With that line of code we can split our
routes.rb file into small compact pieces and forget about huge and long file.
Solution is pretty simple and elegant. At the same time, it makes life easier, especially in rails development :)