The users controller is named UsersController for the simple reasons because it controls multiple users, but in reality doesn’t it change only a couple of parameters which are specific for the certain user?
Therefore, the most logical thing for me would then be that a controller names Dashboard should be named DashboardsController since it controls multiple Dashboards across numerous PC’s and because of the slight change in certain spesific field after rendering the page, for that reason it should be named Dashboards. Like Users are named Users and not User…
That brings me though back to the starting point. How do I decide what to choose; plural or singular? Dashboard is only one specific thing in the application, while users aren’t really controlling just their own, but again Dashboards are all different when the usernames get rendered on the page, as well as specific user favored tags.
What would be the best practice with this?
The rails convention is to define controller names using plural (e.g /dashboards). This isn’t set in stone, and you can change this to fit your needs, but if you’re asking what the best practice is, then your best bet is to stick with the rails convention, especially if you’re just getting started with rails. It will make your life much simpler.
If you really want to use a singular term for your controller (e.g /dashboard), you can specify that in your routes.rb file (this assumes you’re using RESTful routes and defining dashboard as a resource)
Also note that if you decide to go with singular, you’ll need to adjust the helper methods rails creates for RESTful routes accordingly, so