Hello,
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
word.
I have tried this:
ActiveSupport::Inflector.inflections do |inflect|
# insert option here
end
With several options:
1. inflect.singular("regatta", "regatta")
# "regatta".singularize works, but "regattas".singularize returns
"regattas"
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."
1. inflect.irregular "regatta", "regattas" # "regatta".singularize
=>"regattum"
2. inflect.uncountable "regattum" #
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.