This project is archived and is in readonly mode.
[PATCH] Inconsistent behavior in pluralizing uncountable words
-
Paul Barry
- Tag changed from activesupport, inflections to activesupport, inflections, patch
This patch looks good. There's obviously a bug that the test shows which is that existing compound word string, so a word like WhiteRice, is incorrectly pluralized to WhiteRices.
I've attached an updated patch that refactors the implementation of
pluralizeto make it a little clear what's happening, IMHO. Rather than grok the regexps to try to infer the intent, I think it's clearer to just underscore the word and check to see if the last word is in the list of uncountables. It's not obivous whatm = (/(.*_)([a-z]+)$/i.match(result) || /^([A-Za-z]+)([A-Z][a-z]+)$/.match(result))means at a glance. -
David Genord II
While I agree that your code is cleaner to read .underscore is a very expensive method to run in comparison to 2 regular expressions. Considering that pluralize is a heavily used inflection I believe the performance hit is a heavy price in comparison to a comment explaining the regular expressions.
-
Santiago Pastorino
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
