Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[3.0.9] wrong singularization for "sieves" #2395

Closed
sunaku opened this Issue · 7 comments

4 participants

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

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

@nbibler

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. ;)

@sunaku

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

@nbibler

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.

@bensie

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.

@sunaku

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.

@nbibler

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?

@jeremy
Owner

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 jeremy closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.