2

I want to create a model called Match. Will the table for Match be matches or matchs i.e pluralizing with 'es' instead of the normal 's'? If I have another table, Player, belonging to Match, should the reference be match_id? If rails understands how to plularize Match, what other unusual pluralizations does it accept e.g. a model called Misery which would have a normal pluralized form of miseries?

Obromios
  • 15,408
  • 15
  • 72
  • 127
  • 1
    It will be `matches`. When in doubt, just open `rails console` and type `"match".pluralize`. Rails hands the *vast* majority of English pluralizations correctly. It's completely open source, and the source code is available on your local machine, unobfuscated. You can step through it using a debugger if you want to figure out how it handles various English pluralization rules. – user229044 Jun 19 '18 at 02:20

1 Answers1

2

Based on meagar's comment, most english pluralizations are done correctly in rails. If in doubt, you can just open a rails console and type 'model_name".pluralize e.g.

'match'.pluralize

which returns 'matches'. If this doesn't work, then you can roll your own according to this SO answer.

Obromios
  • 15,408
  • 15
  • 72
  • 127