0
votes

I have created a rails app and created a controller. In the Controller class, I created a method called index and set the route as resources :controller_name. When I am creating the server and visit localhost:3000/controller_name, it is showing the index view, when I visit localhost:3000/controller_name/index, An error is showing, which is "The action 'show' could not be found for CategoriesController"

I was just wondering about the valid reason.I created an action called show and the error has gone.

1

1 Answers

0
votes

When you create routes using "resources :controller_name" default routes for CRUD operations are created. Here, you have created a route for the action 'show' but it is not yet defined in the controller. To see the routes you currently have, run rake:routes in your terminal. You can read more about resources and CRUD operations here