You want a route to the url /restaurants to display the list of your restaurants.
# config/routes.rb
resources :restaurants, only: [:index]
Now you can access the url /restaurants.
The route you just design points to the RestourantController
and the action #index
, that's the Rails convention.
Generate the controller from the terminal, don't forget the s
at the end of the controller's name:
rails g controller restaurants
Then add the action #index
:
# app/controllers/restaurants