---
title: "Rails 6 shows routes in expanded format"
description:
  "Rails 6 has added ability to show the routes in an expanded format"
canonical_url: "https://www.bigbinary.com/blog/rails-6-shows-routes-in-expanded-format"
markdown_url: "https://www.bigbinary.com/blog/rails-6-shows-routes-in-expanded-format.md"
---

# Rails 6 shows routes in expanded format

Rails 6 has added ability to show the routes in an expanded format

- Author: Prathamesh Sonpatki
- Published: March 27, 2019
- Categories: Rails 6, Rails

The output of `rails routes` is in the table format.

```bash
$ rails routes
   Prefix Verb   URI Pattern               Controller#Action
    users GET    /users(.:format)          users#index
          POST   /users(.:format)          users#create
 new_user GET    /users/new(.:format)      users#new
edit_user GET    /users/:id/edit(.:format) users#edit
     user GET    /users/:id(.:format)      users#show
          PATCH  /users/:id(.:format)      users#update
          PUT    /users/:id(.:format)      users#update
          DELETE /users/:id(.:format)      users#destroy
```

If we have long route names, they don't fit on the terminal window as the output
lines wrap with each other.

![Example of overlapping routes](https://www.bigbinary.com/blog/images/images_used_in_blog/2019/rails-6-shows-routes-in-expanded-format/overlapping_routes.png)

Rails 6 has added a way to display the routes in an
[expanded format](https://github.com/rails/rails/pull/32130).

We can pass `--expanded` switch to the `rails routes` command to see this in
action.

```bash
$ rails routes --expanded

--[ Route 1 ]--------------------------------------------------------------
Prefix            | users
Verb              | GET
URI               | /users(.:format)
Controller#Action | users#index
--[ Route 2 ]--------------------------------------------------------------
Prefix            |
Verb              | POST
URI               | /users(.:format)
Controller#Action | users#create
--[ Route 3 ]--------------------------------------------------------------
Prefix            | new_user
Verb              | GET
URI               | /users/new(.:format)
Controller#Action | users#new
--[ Route 4 ]--------------------------------------------------------------
Prefix            | edit_user
Verb              | GET
URI               | /users/:id/edit(.:format)
Controller#Action | users#edit

```

This shows the output of the routes command in much more user friendly manner.

The `--expanded` switch can be used in conjunction with
[other switches for searching specific routes](https://blog.bigbinary.com/2016/02/16/rails-5-options-for-rake-routes.html).

## Links

- [Human page](https://www.bigbinary.com/blog/rails-6-shows-routes-in-expanded-format)
