It is a memo for myself so as not to forget it.
procedure
~ How to write ~
HTTP protocol "URL to display page" => "Controller name #Action name" It is described as.
A concrete example is shown below.
route.rb
get "images/index" => "images#index"
When receiving a request to the URL ~ / images / index In this program, it is written to execute the index action in the images controller.
images_controller.rb
def index
end
As I wrote in the route file earlier, after receiving the URL request The program comes to see the images controller. It then looks for the index action and tries to execute it. This time, we are working to increase the flow itself by one, so we will add the corresponding action.
The html.rb file is finally displayed on the browser. route→controller→html
html:index.html.rb
<h1>sample</h1>
Recommended Posts