This time, I would like to explain how to read the routes described when entering the rails routes command.
Simply put, it is a "signpost" that specifies the destination of the request.
You can set the routing by describing it in the routes.rb file.
Rails.application.routes.draw do get 'posts', to: 'posts#index' end
rails routesYou can check the configured routing by entering the command in the terminal.
Prefix Verb URI Pattern Controller#Action posts GET /posts(.:format) posts#index
Prefix ・ ・ ・ URI Pattern with a name and variable Verb ・ ・ ・ HTTP method URI Pattern ・ ・ ・ URL on the Web Controller # Action ・ ・ ・ Controller and action to process the request
By understanding the contents of the above four points, you can grasp the flow of what kind of routine is set and what kind of processing you are trying to perform. Let's understand and enjoy programming together!
Thank you for reading to the end! I hope it will be useful for those who are in trouble or worried about the same part!