plural/singular controller name

I know that using plural for controllers name is the right way in Ruby, but in some cases using singular for controllers name is more appropriately. For example

http://foobar.com/admin/login/
http://foobar.com/admin/dashboard/
http://foobar.com/profile/

I think you get what I mean. So which are the best practices of using singular for controllers names ?

Any example will be appreciated !

Answers


If you don't need the whole scaffolding, for example you probably have no admin model, then you can just generate a controller with a singular name.

rails g controller admin

Then, you need to take care of the routing.

match 'admin/login' => 'admin#login'


Rails favours convention over configuration, so it means that controllers are ALWAYS using plural, table names also, whereas models are always using singular, with an uppercase at the beginning.

I would strongly advice you to stick to these conventions, that's best practice and in the foundation of the Rails framework


Need Your Help

SHIFT Shortcut being displayed as MAJ for culture "nl-BE" when it should be SHIFT (C#.NET)

c# localization infragistics culture user32

After a long discussion with Infragistics it appears that ShortCuts with SHIFT are displayed as MAJ in my culture "nl-BE". First of all, the culture "nl-BE" and AZERTY is somewhat of a strange thing.

What C++ IDEs on Linux have "intellisense" in par with, or better, than Visual Studio?

c++ linux visual-studio ide

There are some Linux based C++ projects in the pipe. What IDEs should I go for that have some kind of "intellisense" in par with, or better, than the one of a bare Visual Studio (that is, without the