Browse files

Changed the way inflections for uncountables work for 'funky jeans'

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 0653a6d commit fcec7402eb6fb9af9b6a7115648119219120308e @rolfb rolfb committed with josevalim Apr 8, 2010
View
2 activesupport/lib/active_support/inflections.rb
@@ -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
2 activesupport/lib/active_support/inflector.rb
@@ -158,7 +158,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) }
View
4 activesupport/test/inflector_test_cases.rb
@@ -12,7 +12,9 @@ module InflectorTestCases
"stack" => "stacks",
"wish" => "wishes",
"fish" => "fish",
-
+ "jeans" => "jeans",
+ "funky jeans" => "funky jeans",
+
"category" => "categories",
"query" => "queries",
"ability" => "abilities",

0 comments on commit fcec740

Please sign in to comment.