Pluralize method Possible Bug

Hello Everyone

I am beginner to ruby on rails but lately while working on a Rails Project I stumbled on this anomaly.

I encountered this problem while naming my Rails Model Plural (Alumni),my bad forgot the convention and was amazed to find Table name in the database (supposed to be plural of Model name according to the convention) to be Alumnis. Please have a look at this-

irb(main):001:0> “woman”.pluralize

=> “women”

#Have a look at this one

irb(main):002:0> “alumnus”.pluralize

=> “alumnus”

#Have a look at this one

irb(main):003:0> “alumni”.pluralize

=> “alumnis”

irb(main):004:0> “cow”.pluralize

=> “kine”

irb(main):005:0> “man”.pluralize

=> “men”

irb(main):006:0> “cat”.pluralize

=> “cats”

irb(main):007:0> “dolphin”.pluralize

=> “dolphins”

irb(main):008:0> “dog”.pluralize

=> “dogs”

irb(main):009:0> “Tigress”.pluralize

=> “Tigresses”

As you can see that for every other word except Alumnus(whose plural is Alumni) and Alumni(which is itself a plural form) pluralize method returns the exact plural word. Is this a bug in the method implementation?

Can someone please also explain how the above Rails convention is implemented i.e. Pluralization of Model Name as Table Name in Database

Thanks in Advance

Regards

Hello Everyone

I am beginner to ruby on rails but lately while working on a Rails Project I stumbled on this anomaly.

I encountered this problem while naming my Rails Model Plural (Alumni),my bad forgot the convention and was amazed to find Table name in the database (supposed to be plural of Model name according to the convention) to be Alumnis.

Pluralisation is handled via a set of rules. They aren't perfect but last time I checked bugs are not accepted against these rules because it would be too easy to break apps that depending on the previous pluralisation (and equally it's difficult to be sure that you're not introducing new pluralization errors)

You can add your own rules though - see ActiveSupport::Inflector::Inflections

Fred