Skip to content

Commit

Permalink
Changed the way inflections for uncountables work for 'funky jeans' [#…
Browse files Browse the repository at this point in the history
…3576 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
rolfb authored and josevalim committed Apr 5, 2010
1 parent efa7e96 commit 4eab983
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/inflections.rb
Expand Up @@ -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
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/inflector/inflections.rb
Expand Up @@ -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) }
Expand Down
2 changes: 2 additions & 0 deletions activesupport/test/inflector_test_cases.rb
Expand Up @@ -12,6 +12,8 @@ module InflectorTestCases
"stack" => "stacks",
"wish" => "wishes",
"fish" => "fish",
"jeans" => "jeans",
"funky jeans" => "funky jeans",

"category" => "categories",
"query" => "queries",
Expand Down

0 comments on commit 4eab983

Please sign in to comment.