Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resources vs resource rails 3

I was told that if I only have one "thing", like home (not multiple homes), I should use resource :home, not resources :home in routes.rb. But then when I look at routes, the POST function seems to want homes#create. Why plural? I wanted to name my controller home_controller with the class being HomeController. Do I have to name them plural?

like image 662
dt1000 Avatar asked Jun 07 '12 00:06

dt1000


1 Answers

Modified quote from http://guides.rubyonrails.org/routing.html#nested-resources:

Because you might want to use the same controller for a singular route (/home) and a plural route (/homes/45), singular resources map to plural controllers.

like image 114
cdesrosiers Avatar answered Oct 02 '22 04:10

cdesrosiers