Why in Ruby on Rails the name of the controller and the resource must match? When they do not match, an error is displayed that, they say, does not see such a controller in the folder.

PS Rails 4.

  • Do you mean the directive of resources in routs? - mayar
  • Yes Yes. This is navi1893

1 answer 1

Because when using resources, the name of the controller to which the request is transmitted is calculated automatically from the resource name and, therefore, must comply with certain rules. In addition, the rail creates wolf methods based on these names.

The controller, however, can be specified manually.

resources :images, controller: "products_images"