mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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:
@@ -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 @@ 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) }
|
||||
|
||||
@@ -12,6 +12,8 @@ module InflectorTestCases
|
||||
"stack" => "stacks",
|
||||
"wish" => "wishes",
|
||||
"fish" => "fish",
|
||||
"jeans" => "jeans",
|
||||
"funky jeans" => "funky jeans",
|
||||
|
||||
"category" => "categories",
|
||||
"query" => "queries",
|
||||
|
||||
Reference in New Issue
Block a user