[3.0.9] wrong singularization for "sieves" #2395

Closed
sunaku opened this Issue Aug 2, 2011 · 7 comments

Comments

Projects
None yet
4 participants
Contributor

sunaku commented Aug 2, 2011

>> 'sieve'.pluralize
"sieves"
>> 'sieve'.pluralize.singularize
"siefe"

The singular form of "sieves" should be "sieve", not "siefe". Thanks.

Contributor

nbibler commented Aug 2, 2011

Generally, pluralization issues are taken care of in your own application's config/inflections.rb file. I'm guessing that you'd want something like:

ActiveSupport::Inflector.inflections do |inflect|
  inflect.singular 'sieves', 'sieve'
end

If you were feeling particularly crazy — mostly because I'm sure this will somehow bite you later — you could use a regex instead of a string match there and replace all /eves$/i with eve:

inflect.singular /^(.+)eves$/i, '\1eve'

That would also fix the case of "sleeve" not becoming "sleefe." I'd be careful with that one though. ;)

Contributor

sunaku commented Aug 2, 2011

Thanks for the temporary workaround. But are you also suggesting that this issue won't be fixed in Rails itself?

Contributor

nbibler commented Aug 2, 2011

It's certainly possible that it may be, but I wouldn't imagine it's a priority for anyone and will likely be sidelined. I'm not on Core, so it's not for me to say.

Contributor

bensie commented Aug 2, 2011

Rails core has made it pretty clear that no new additions to the inflector will be accepted. Use config/inflections.rb permanently -- not just as a temporary workaround.

Contributor

sunaku commented Aug 2, 2011

Does that seem fair to you? A no-further-improvements policy is a prescription for bit-rot and obsolescence.

To have improvements pile up in an issue tracker (like this) and deal with them later is fine. But to reject them outright, because you haven't the time/resources to deal with them at present, is simply too extreme IMHO.

Contributor

nbibler commented Aug 2, 2011

It's more likely that the inflector itself should be taken over into another project. There is a lot of upkeep involved with it ... and so far it only generally supports English, I believe. There's a lot that COULD go into it.... but resources and development focus rule. I, honestly, don't know that inflection rules should continue to be a core feature to Rails...

My suggestion — knowing that it is likely very unpopular — would be to take the current inflector and start a new library with the same or very similar API. It could be a drop-in replacement, eventually, and be more focused and fully featured.

But, that's the joy of open source, huh?

Owner

jeremy commented Oct 8, 2011

The default set of inflections was frozen because constantly tweaking it just leads to hellish scenarios for anyone upgrading and dealing with "fixed" inflections that now break their models.

It's a compatibility quagmire, so we drew a line in the sand. No more; good enough; define your own from this baseline.

jeremy closed this Oct 8, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment