Hi,
I would like to be able to iterate over all my application routes.
Basically, like “rake routes” does. My goal is:
- to generate code from that routes set
- pretty print each route spec
- build a complete mapping between the controllers’ actions and the
routes.
I have found some interesting classes in rails source code, but they
look
like I should not use them because they are for internal use only.
Something like:
$ rails c
Rails.application.routes.named_routes.each {|n, r| p ‘==============’,
n, r
}
or this class ActionDispatch::Routing::RoutesInspector
Is there a public API that would be maintain across different rails
releases that I could use?
Thanks in advance,
–
Nicolas D.