mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fix inflector bug where -ice gets pluralized into -ouse
This should happen for mouse or louse, but not slice or pumice.
This commit is contained in:
parent
cbe74cf024
commit
16e7f2f809
2 changed files with 7 additions and 5 deletions
|
@ -16,8 +16,8 @@ module ActiveSupport
|
|||
inflect.plural(/([^aeiouy]|qu)y$/i, '\1ies')
|
||||
inflect.plural(/(x|ch|ss|sh)$/i, '\1es')
|
||||
inflect.plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices')
|
||||
inflect.plural(/(m|l)ouse$/i, '\1ice')
|
||||
inflect.plural(/(m|l)ice$/i, '\1ice')
|
||||
inflect.plural(/^(m|l)ouse$/i, '\1ice')
|
||||
inflect.plural(/^(m|l)ice$/i, '\1ice')
|
||||
inflect.plural(/^(ox)$/i, '\1en')
|
||||
inflect.plural(/^(oxen)$/i, '\1')
|
||||
inflect.plural(/(quiz)$/i, '\1zes')
|
||||
|
@ -36,7 +36,7 @@ module ActiveSupport
|
|||
inflect.singular(/(s)eries$/i, '\1eries')
|
||||
inflect.singular(/(m)ovies$/i, '\1ovie')
|
||||
inflect.singular(/(x|ch|ss|sh)es$/i, '\1')
|
||||
inflect.singular(/(m|l)ice$/i, '\1ouse')
|
||||
inflect.singular(/^(m|l)ice$/i, '\1ouse')
|
||||
inflect.singular(/(bus)(es)?$/i, '\1')
|
||||
inflect.singular(/(o)es$/i, '\1')
|
||||
inflect.singular(/(shoe)s$/i, '\1')
|
||||
|
@ -58,6 +58,6 @@ module ActiveSupport
|
|||
inflect.irregular('cow', 'kine')
|
||||
inflect.irregular('zombie', 'zombies')
|
||||
|
||||
inflect.uncountable(%w(equipment information rice money species series fish sheep jeans))
|
||||
inflect.uncountable(%w(equipment information rice money species series fish sheep jeans police))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -109,7 +109,9 @@ module InflectorTestCases
|
|||
|
||||
# regression tests against improper inflection regexes
|
||||
"|ice" => "|ices",
|
||||
"|ouse" => "|ouses"
|
||||
"|ouse" => "|ouses",
|
||||
"slice" => "slices",
|
||||
"police" => "police"
|
||||
}
|
||||
|
||||
CamelToUnderscore = {
|
||||
|
|
Loading…
Reference in a new issue