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

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Rolf Bjaanes
2009-12-15 18:36:28 +01:00
committed by José Valim
parent efa7e96821
commit 4eab983b95
3 changed files with 4 additions and 2 deletions

View File

@@ -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

View File

@@ -148,7 +148,7 @@ module ActiveSupport
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) }

View File

@@ -12,6 +12,8 @@ module InflectorTestCases
"stack" => "stacks",
"wish" => "wishes",
"fish" => "fish",
"jeans" => "jeans",
"funky jeans" => "funky jeans",
"category" => "categories",
"query" => "queries",