Skip to content

Commit

Permalink
Merge pull request #5177 from cap10morgan/fix-gh-issue-4374
Browse files Browse the repository at this point in the history
fix inflector bug where -ice gets singularized into -ouse
  • Loading branch information
josevalim committed Apr 30, 2012
2 parents 976b170 + 16e7f2f commit 66c5ac3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions activesupport/lib/active_support/inflections.rb
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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
4 changes: 3 additions & 1 deletion activesupport/test/inflector_test_cases.rb
Expand Up @@ -109,7 +109,9 @@ module InflectorTestCases

# regression tests against improper inflection regexes
"|ice" => "|ices",
"|ouse" => "|ouses"
"|ouse" => "|ouses",
"slice" => "slices",
"police" => "police"
}

CamelToUnderscore = {
Expand Down

0 comments on commit 66c5ac3

Please sign in to comment.