Inflector bug/inconsistent behaviour - what to do?

Pull request/discussion here: https://github.com/rails/rails/pull/7134

(I’m not talking about adding inflector rules here, I’m aware the rules are frozen.)

Summary of the ticket:

I ran into an inflector bug lately. The root of the problem seems to be that no one really knows what singularize/pluralize is supposed to take as arguments, and different part of Rails started making different assumptions about it:

  1. The writer of the inflector rules assumed singularize/pluralize should take a single word as an argument, and starting writing rules like /^…$/i

  2. The tests say it should work with “multi-world phrases

  3. tableize says it should work with “underscore_seperated_phrases” (this is important because ActiveRecord relies on this)

  4. The documentation says it should work with CamelCasePhrases as well, but there are no tests for these at all

As a result, nothing really works correctly right now. It worked okay most of the time, but that’s more or less a miracle, and new commits keep changing the behaviour for certain not-so-uncommon test cases. Fixing this manually (it’s more like hacking around the problem) by adding your custom inflector rules is non-trivial. (See the Github ticket for details.)

I have a fix ready for this (attached in the PR) but it will likely change the behaviour of tableize (which we already broke in master btw - and actually it’s pretty much been broken all along, see ticket), so it could in theory break some apps out there.

Because of the potential impact, your feedback on this is much appreciated.

Thanks!

Godfrey