[LINUX] About rails routes command

rails routes command description

When you run the rails routes command in your application's directory, You can see the routing configured in that application. In short, I want to know when I enter the rails routes command into the terminal You can check the routing.

Example

Terminal

#Check if it is the directory of the created application (application name "sample"_In the case of "app")
% pwd
/Users/username/projects/sample_app

#Check the configured routing
/Users/User name sample_app % rails routes

At the time of confirmation, the routing will be displayed to fill the screen width of the terminal, so expand the screen to make it easier to see and check the display.

It will be displayed in the terminal as shown in the example below. Also, if the following display is displayed, the routing is correct. It is set.

Terminal

Prefix  Verb  URI Pattern       Controller#Action
posts   GET   /posts(.:format)  posts#index
(Omitted below)

If you are not sure even if you look at the execution result of rails routes Please read the contents referring to the image below.

rails routes.png

This is the foundation of the foundation, so you need to understand it well.

Summary

** The rails routes command is a command to list the routes set in the application. ** **

** Basically, there are many commands, so I don't think I can remember them. I can't really remember. w However, if you remember the commands for checking something, you can work on it. It's a good idea to remember these commands as you can proceed efficiently! !! ** **

Recommended Posts

About rails routes command
About the service command