Pluralization in Rails

So, there is this one big and neat framework called Rails, building on top of this one neat new programming language called Ruby.

And one of the things that makes Rails so Damn Neat is that if you only set things up the right way around, it guesses almost everything you need it to guess for you.

One of the ways it does this is by pluralization. Basically, the model Foo has a model defined in app/model/foo.rb and it accesses the database table foos.

So, when talking a good friend through the basics, we created the table persons and generated the model Person. And promptly got an error from the framework.

It turns out that the pluralization of person is people. I wonder what else irregularities they built into the system. If I have a model called Index, does Rails expect it to read from the database table indexes or from indices?

Edited to add:

So, I found out that in the Rails console, I can fiddle around with pluralization myself.

Which lead to this experiment

"index".pluralize
>> "index".pluralize
=> "indices"
>> "simplex".pluralize
=> "simplices"
>> "matrix".pluralize
=> "matrices"
>> "complex".pluralize
=> "complices"

And at this point, the chosen pluralization engine simply Does Not Work. The pluralization of complex, at least as used in mathematics, is under no circumstances complices. We'd say complexes. Matrices, on the other hand, pluralizes correctly. And simplices pluralize correctly or incorrectly depending on which mathematician you ask.

social