Expanded rails routes in Rails 6.0
Published in
1 min readJun 7, 2018
In Rails 6.0, rails routes
command will support --expanded
(or -x
, the shorthand version). This is similar to \x
mode in psql
where it will print the record in detailed list instead of in a table.
$ rails routes --expanded
--[ Route 1 ]-------------------------------------------------------
Prefix | high_scores
Verb | GET
URI | /high_scores(.:format)
Controller#Action | high_scores#index
--[ Route 2 ]-------------------------------------------------------
Prefix | new_high_score
Verb | GET
URI | /high_scores/new(.:format)
Controller#Action | high_scores#new
--[ Route 3 ]-------------------------------------------------------
Prefix | blog
Verb |
URI | /blog
Controller#Action | Blog::Engine[ Routes for Blog::Engine ]
--[ Route 1 ]-------------------------------------------------------
Prefix | cart
Verb | GET
URI | /cart(.:format)
Controller#Action | cart#show
I think this is very useful for when you have a lot of complex routes and it’s hard to see unless you have a very huge display.
You can find more details in the pull request from Benoit Tigeot here: