提交 4eab983b 编写于 作者: R Rolf Bjaanes 提交者: José Valim

Changed the way inflections for uncountables work for 'funky jeans' [#3576 state:resolved]

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 efa7e968
......@@ -51,6 +51,6 @@ module ActiveSupport
inflect.irregular('move', 'moves')
inflect.irregular('cow', 'kine')
inflect.uncountable(%w(equipment information rice money species series fish sheep))
inflect.uncountable(%w(equipment information rice money species series fish sheep jeans))
end
end
......@@ -148,7 +148,7 @@ def pluralize(word)
def singularize(word)
result = word.to_s.dup
if inflections.uncountables.include?(result.downcase)
if inflections.uncountables.any? { |inflection| result =~ /#{inflection}\Z/i }
result
else
inflections.singulars.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
......
......@@ -12,6 +12,8 @@ module InflectorTestCases
"stack" => "stacks",
"wish" => "wishes",
"fish" => "fish",
"jeans" => "jeans",
"funky jeans" => "funky jeans",
"category" => "categories",
"query" => "queries",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册