Should I use /article or /articles ?
The Controller suffix is always singular. The name of the resource is usually plural. Controller actions use snake_case and usually match the standard route names Rails defines ( index , show , new , create , edit , update , delete ).
Controller names are either singular or plural : Using “rails g resource” names the controllers plural, which makes sense because I think about them controlling many routes. Resource names are singular : They create a lot of mvc framework, the name you pass will become the model name, and let rails pluralize the rest.
You can use either. If you are defining your routes using resource(s) then it's best to use plural controller names, because that is the default:
resources :articles
resource :articles
But it is possible to specify other controller names as well:
resources :articles, :controller => 'article'
resource :article, :controller => 'article'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With