Decrease complexity of routes in Rails
1 min readOct 25, 2017
Sometimes, when you working with large codebase your `routes.rb` files grows really fast and become very dirty.
There are several things that makes your routes file bigger:
- Customisation of devise.
- Specific gems that mount additional routes (Active Admin, ActionCable)
- Sidekiq + SidekiqWeb + Basic authentication
- Namespaces with APP or API
All this points leads to one fact — your file grows and it is hard to maintain it.
But do you need all this staff in regular work, when you add some controller with another resource? My answer was No.
With that line of code we can split our `routes.rb` file for small compact pieces and forget about huge and long file.
Solution is pretty simple and elegant and in same time it makes life easy. :)