Hello Everyone
I am beginner to ruby but lately while working on a Rails Project I
stumbled on this anomaly.
Please have a look at this code-
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?
I encountered this problem while naming my Rails Model Plural (Alumni)
and
was amazed to find Table name in the database (supposed to be plural of
Model name according to the convention) to be Alumnis.
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
Varun Wachaspati J
B.E.(Hons.)Computer Science | LinkedIn
https://mailtrack.io/trace/link/3eb2efe9572b8b1501c11c5ecbf771d33ef3b136
|
+91-8094068111
Birla Institute of Technology & Science, Pilani