# Pluralis versus Singularis

**URL:** <https://www.ruby-forum.com/t/pluralis-versus-singularis/50804>\
**Category:** Rails\
**Created:** [November 29, 2005, 9:07am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804 "2005-11-29T09:07:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 29, 2005, 9:07am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/1 "2005-11-29T09:07:49Z")

</div>

What would happen if Singularis was used everywhere instead of Pluralis?  
(table name User instead of Users, etc)

Are the advantages really outweighing the disadvantages?

There must exist other ways of handling naming conflicts. Like user and  
User or tblUser.

Christer

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 29, 2005, 9:24am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/2 "2005-11-29T09:24:23Z")

</div>

On Nov 29, 2005, at 17:07 , Christer N. wrote:

> What would happen if Singularis was used everywhere instead of  
> Pluralis?  
> (table name User instead of Users, etc)
> 
> Are the advantages really outweighing the disadvantages?

I’m curious: what are the disadvantages of naming tables with  
plurals? I was doing this long before using Rails. A table (or  
relation) is a set of predicates: it’s a collection. To me, it’s  
natural to tables with a plural.

For legacy databases, of course you have to work with what you’re  
given. For new projects using Rails, it just means one less thing you  
need to configure if you name your tables with plurals: otherwise you  
can use set\_table\_name to name it whatever you’d like.

Michael G.  
grzm myrealbox com

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 29, 2005, 9:29am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/3 "2005-11-29T09:29:39Z")

</div>

The problem is that pluralize is not complete. The other day one guy  
missed five out five plurals. Reason: Pluralize didn’t handle them  
correctly.

What are the disadvantages of using the singular form everywhere ?

Christer

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 29, 2005, 9:52am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/4 "2005-11-29T09:52:39Z")

</div>

On 29.11.2005, at 10.29, Christer N. wrote:

> The problem is that pluralize is not complete. The other day one guy  
> missed five out five plurals. Reason: Pluralize didn’t handle them  
> correctly.
> 
> What are the disadvantages of using the singular form everywhere ?

Disadvantages in _you_ using them, or disadvantages in _Rails_  
ditching the whole pluralisation scheme?

If the former, you have to specify the table name by hand for every  
class, so a little more work and less DRYness.

If the latter, well, it’s the convention (not only in Rails but in  
rdbms literature, too) and it makes a lot of things more “human”. An  
athlete has\_many :fans, not many :fan. And like Michael mentioned,  
tables (as opposed to classes) are collections of objects.

Remember, Rails is opinionated software, and the domain-specific  
language is definitely one of the things that sets it apart. Also,  
the pluralisation scheme is not carved in stone, you’re free to  
submit patches so that the things that didn’t work for you would be  
fixed.

Personally, I haven’t had a single problem with pluralisation during  
my 15 months on Rails. It is true, though, that I’ve been fortunate  
enough to avoid working with legacy databases altogether.

//jarkko

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 29, 2005, 10:12am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/5 "2005-11-29T10:12:26Z")

</div>

Here are the two examples, that made pluralize fail:

Syllabus has the unusual plural form Syllabi.  
Curriculum has the unusual plural form Curricula.

The plural form makes the code more readable, I agree. Writing  
users.name in sql is not nice, but rails hides this and uses user.name  
instead. And it is easy to add the correct table name by hand if  
necessary. And it is possible to augment pluralize as well, and make an  
open source patch contribution.

I was just opposing how people defends the pluralization: It’s a  
convention and therefore not necessary to discuss. But your argument  
convinced me.

Maybe the matching between singular forms and plural forms can be  
smarter. Example: we have ten models with singular names and ten tables  
with plural names. By edit distance comparisons it is possible to find  
the most likely mappings. (The edit distance between Syllabus and  
Syllabi is two, one replace character and one delete character)

Christer

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 29, 2005, 10:41am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/6 "2005-11-29T10:41:18Z")

</div>

Hi gentlemen

What is the current process for adding new plurals to the list of  
supported  
plurals ?

Should we have this list exposed as some kind of moderated wiki online,  
to  
allow more people (including non technical people willing to help) to  
add  
new plurals ?

just random thoughts (maybe all this is already in place ?)

Thibaut

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 29, 2005, 6:06pm UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/7 "2005-11-29T18:06:43Z")

</div>

On Nov 29, 2005, at 2:55 AM, Christer N. wrote:

> In active\_support/inflections.rb the rules and exceptions are listed.  
> Maybe a wiki would be better for linguists uncomfortable with regular  
> expressions!  
> A simple database would make the process even easier.  
> It would also be a help to have a web page for testing in both  
> directions. Maybe there is one, I didn’t find any.  
> Maybe this is not a problem big enough to spend time on.
> 
> Using “would” too many times indicates spending time fixing the code  
> would be wiser.

Also if you are running one of the new release candidates ( you are  
aren’t you?), You can add your own pluralization rules to the bottom  
of your environment.rb file. There is a section there that is  
commented out that shows how to do so.

Cheers-

-Ezra Z.  
WebMaster  
Yakima Herald-Republic Newspaper  
removed\_email\_address@domain.invalid  
509-577-7732

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 29, 2005, 11:55am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/8 "2005-11-29T11:55:05Z")

</div>

In active\_support/inflections.rb the rules and exceptions are listed.  
Maybe a wiki would be better for linguists uncomfortable with regular  
expressions!  
A simple database would make the process even easier.  
It would also be a help to have a web page for testing in both  
directions. Maybe there is one, I didn’t find any.  
Maybe this is not a problem big enough to spend time on.

Using “would” too many times indicates spending time fixing the code  
would be wiser.

Inflector.inflections do |inflect|  
inflect.plural /$/, ‘s’  
inflect.plural /s$/i, ‘s’  
inflect.plural /(ax|test)is$/i, ‘\1es’  
inflect.plural /(octop|vir)us$/i, ‘\1i’  
inflect.plural /(alias|status)$/i, ‘\1es’  
inflect.plural /(bu)s$/i, ‘\1ses’  
inflect.plural /(buffal|tomat)o$/i, ‘\1oes’  
inflect.plural /([ti])um$/i, ‘\1a’  
inflect.plural /sis$/i, ‘ses’  
inflect.plural /(?:([^f])fe|([lr])f)$/i, ‘\1\2ves’  
inflect.plural /(hive)$/i, ‘\1s’  
inflect.plural /([^aeiouy]|qu)y$/i, ‘\1ies’  
inflect.plural /([^aeiouy]|qu)ies$/i, ‘\1y’  
inflect.plural /(x|ch|ss|sh)$/i, ‘\1es’  
inflect.plural /(matr|vert|ind)ix|ex$/i, ‘\1ices’  
inflect.plural /([m|l])ouse$/i, ‘\1ice’  
inflect.plural /^(ox)$/i, ‘\1en’  
inflect.plural /(quiz)$/i, ‘\1zes’

inflect.singular /s$/i, ‘’  
inflect.singular /(n)ews$/i, ‘\1ews’  
inflect.singular /([ti])a$/i, ‘\1um’  
inflect.singular  
/((a)naly|(b)a|(d)iagno|§arenthe|§rogno|(s)ynop|(t)he)ses$/i,  
‘\1\2sis’  
inflect.singular /(^analy)ses$/i, ‘\1sis’  
inflect.singular /([^f])ves$/i, ‘\1fe’  
inflect.singular /(hive)s$/i, ‘\1’  
inflect.singular /(tive)s$/i, ‘\1’  
inflect.singular /([lr])ves$/i, ‘\1f’  
inflect.singular /([^aeiouy]|qu)ies$/i, ‘\1y’  
inflect.singular /(s)eries$/i, ‘\1eries’  
inflect.singular /(m)ovies$/i, ‘\1ovie’  
inflect.singular /(x|ch|ss|sh)es$/i, ‘\1’  
inflect.singular /([m|l])ice$/i, ‘\1ouse’  
inflect.singular /(bus)es$/i, ‘\1’  
inflect.singular /(o)es$/i, ‘\1’  
inflect.singular /(shoe)s$/i, ‘\1’  
inflect.singular /(cris|ax|test)es$/i, ‘\1is’  
inflect.singular /([octop|vir])i$/i, ‘\1us’  
inflect.singular /(alias|status)es$/i, ‘\1’  
inflect.singular /^(ox)en/i, ‘\1’  
inflect.singular /(vert|ind)ices$/i, ‘\1ex’  
inflect.singular /(matr)ices$/i, ‘\1ix’  
inflect.singular /(quiz)zes$/i, ‘\1’

inflect.irregular ‘person’, ‘people’  
inflect.irregular ‘man’, ‘men’  
inflect.irregular ‘child’, ‘children’  
inflect.irregular ‘sex’, ‘sexes’  
inflect.irregular ‘move’, ‘moves’

inflect.uncountable %w( equipment information rice money species  
series fish sheep )  
end

---

<div class="post-metadata">

**Author:** ![christer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@christer](https://www.ruby-forum.com/u/christer)\
**Post date:** [November 30, 2005, 8:19am UTC](https://www.ruby-forum.com/t/pluralis-versus-singularis/50804/9 "2005-11-30T08:19:35Z")

</div>

Christer N. wrote:

> inflect.plural /(octop|vir)us$/i, ‘\1i’

That’s a bug, isn’t it?

Viri wouldn’t be the right plural for virus in  
either english (from the Oxford English Dictionary):  
“b Pl. viruses. An infectious organism that…”  
or in latin where the word “viri” is a completely  
different word meaning “men”. [1]

And octopuses is a more proper plural since the  
word has greek rather than latin origins. [2]

[1] [What's the Plural of 'Virus'?](http://linuxmafia.com/~rick/faq/plural-of-virus.html)  
[2] [Octopus - Wikipedia](http://en.wikipedia.org/wiki/Octopus#Plural)
