diff options
author | Xavier Noria <fxn@hashref.com> | 2012-02-10 11:14:10 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2012-02-10 11:14:10 -0800 |
commit | 6728191494a3ee1248e86d4b96d7973299675827 (patch) | |
tree | b7cf1824ed7ef6f23ddf452ca4d187bb720ed15d /activesupport/lib | |
parent | 3092324ef4e2f6f096adfbcf92597502b3ce91aa (diff) | |
parent | 532cd49530bd1acca96c1c615b6b328bce42103a (diff) | |
download | rails-6728191494a3ee1248e86d4b96d7973299675827.tar.gz rails-6728191494a3ee1248e86d4b96d7973299675827.tar.bz2 rails-6728191494a3ee1248e86d4b96d7973299675827.zip |
Merge pull request #4719 from markmcspadden/singularize_words_that_end_in_ss
Add Inflection test (and fixes) to ensure singularizing a singular actually give you the correct singular in more cases
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/inflections.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/inflections.rb b/activesupport/lib/active_support/inflections.rb index 527cce2594..e91289e18f 100644 --- a/activesupport/lib/active_support/inflections.rb +++ b/activesupport/lib/active_support/inflections.rb @@ -23,10 +23,11 @@ module ActiveSupport inflect.plural(/(quiz)$/i, '\1zes') inflect.singular(/s$/i, '') + inflect.singular(/(ss)$/i, '\1') inflect.singular(/(n)ews$/i, '\1ews') inflect.singular(/([ti])a$/i, '\1um') - inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i, '\1\2sis') - inflect.singular(/(^analy)ses$/i, '\1sis') + inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '\1\2sis') + inflect.singular(/(^analy)(sis|ses)$/i, '\1sis') inflect.singular(/([^f])ves$/i, '\1fe') inflect.singular(/(hive)s$/i, '\1') inflect.singular(/(tive)s$/i, '\1') @@ -36,12 +37,12 @@ module ActiveSupport inflect.singular(/(m)ovies$/i, '\1ovie') inflect.singular(/(x|ch|ss|sh)es$/i, '\1') inflect.singular(/(m|l)ice$/i, '\1ouse') - inflect.singular(/(bus)es$/i, '\1') + inflect.singular(/(bus)(es)?$/i, '\1') inflect.singular(/(o)es$/i, '\1') inflect.singular(/(shoe)s$/i, '\1') - inflect.singular(/(cris|ax|test)es$/i, '\1is') - inflect.singular(/(octop|vir)i$/i, '\1us') - inflect.singular(/(alias|status)es$/i, '\1') + inflect.singular(/(cris|ax|test)(is|es)$/i, '\1is') + inflect.singular(/(octop|vir)(us|i)$/i, '\1us') + inflect.singular(/(alias|status)(es)?$/i, '\1') inflect.singular(/^(ox)en/i, '\1') inflect.singular(/(vert|ind)ices$/i, '\1ex') inflect.singular(/(matr)ices$/i, '\1ix') |