You may want to specify the main screen in the rails app. In such a case, you can easily specify it by specifying root in routes.rb.
config/routes.rb
root to: "Controller name#Action name"
Now you can specify the main screen.
Let's write an example. If you want to specify the view of the index action of posts_controller on the main screen,
config/routes.rb
root to: "posts#index"
It is described as.
In this case, even if you do not write the index action in posts_controller, you can display it as a view as long as you have app / views / posts / index.html.erb.
Thank you for watching until the end.
Recommended Posts