Can someone tell me how to teach the Inflector to stop treating a
particular word as irregular that is not?
I have an app that has a model named “Regatta” and another model named
“RegattaInclusion” (which is the join model for an HMT relation.
Out of the box, “regatta”.singularize returns “regattum”, which is not a
I have tried this:
ActiveSupport::Inflector.inflections do |inflect|
insert option here
With several options:
- inflect.singular(“regatta”, “regatta”)
“regatta”.singularize works, but “regattas”.singularize returns
2. if I add inflect.plural(“regattas”, “regatta”), it works the same
as in 1.
3. inflect.irregular(“regatta”, “regattas”)
# has no effect
None of the tools in the Inflector::Inflections module seem to address
this problem - a word that looks like an irregular plural, but is really
just a normal singular.
In case you are wondering why this matters, it’s because I’m using
Railroad to build an ERD, and it is giving me a fake entity called
“Regattum” that some of my relationships are going through. If I try to
fix it with inflections, then it crashes because Rails tells it the
class is called “Regattas” instead of “Regatta.”
- inflect.irregular “regatta”, “regattas” # “regatta”.singularize
- inflect.uncountable “regattum” #