Why default to plural controller in generate scaffold?

from ‘generate scaffold’:

“If a controller name is not given, the plural form of
the model name will be used. The model and controller
names may be given in CamelCase or under_score and
should not be suffixed with ‘Model’ or ‘Controller’.
Both model and controller names may be prefixed with a
module like a file path; see the Modules Example for
usage.”

Isn’t this the complete opposite of the whole
singularization philosophy? I thought controllers were
supposed to be singular.

But it doesn’t work anyhow:

generate scaffold Abc
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.include?

csn


Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Nov 14, 2005, at 6:25 PM, CSN wrote:

Isn’t this the complete opposite of the whole
singularization philosophy? I thought controllers were
supposed to be singular.

Not sure about that. Explain?

But it doesn’t work anyhow:

generate scaffold Abc
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.include?

This bug has been fixed in the next release. Please specify both
model and controller name:
script/generate scaffold Abc Abc

jeremy

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDeVHkAQHALep9HFYRAhlHAKDdvBy4dYxrAjrNZBihiKlsHgdq4QCdFQuR
jq+6qzPF0i3HmT0s1omyddg=
=Ehvk
-----END PGP SIGNATURE-----

— Jeremy K. [email protected] wrote:

names may be given in CamelCase or under_score and
were
supposed to be singular.

Not sure about that. Explain?

Everything I’ve read in Rails states that tables
should be singularized when creating models and
controllers, e.g. items table → Item controller, Item
model. Seems like the default should be to create a
singular model. Or at least match the inflection of
the controller.

csn


Yahoo! Mail - PC Magazine Editors’ Choice 2005

On 11/14/05, CSN [email protected] wrote:

form of

model. Seems like the default should be to create a
Yahoo! Mail - PC Magazine Editors’ Choice 2005
http://mail.yahoo.com


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

While it’s true that Rails defaults would lead you to have an items
table → Item model, I don’t believe I’ve heard anyone apply the same
convention to controller names. As far as I’ve seen, most people seem
to use singular/plural controller names interchangeably, depending on
the specific case, and what they prefer.

Gabe

On 11/14/05, Gabe B. [email protected] wrote:

“If a controller name is not given, the plural
usage.”
controllers, e.g. items table → Item controller, Item


convention to controller names. As far as I’ve seen, most people seem
to use singular/plural controller names interchangeably, depending on
the specific case, and what they prefer.

Gabe

“Interchangeably” might have been a poor choice of words; that implies
someone might use both singular and plural forms to refer to the same
controller. Of course, I meant that someone might use the singular
form for one controller name (i.e. ItemsController), and the plural
form for another (i.e. BlogController).

:slight_smile:

Gabe

Of course, I meant that someone might use the singular
form for one controller name (i.e. ItemsController), and the plural
form for another (i.e. BlogController).

I prefer the other way around :wink:
Plural = ItemsController
Singular = BlogController

Craig

On 11/15/05, Craig W. [email protected] wrote:

Craig W. | web: http://xeriom.net/ | Monkey see, monkey do: Okay.
Xeriom.NET | tel: +44 (0)131 516 8595 | Monkey top post: Bad monkey.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Hmm. Now that you mention it, I think I like your way better. :slight_smile:

Gabe