From 9b4622a483319f3d1e7f4489442f0d86afb6da36 Mon Sep 17 00:00:00 2001 From: John Paul Ashenfelter Date: Tue, 30 Nov 2010 13:48:25 -0500 Subject: Added a word boundary to uncountable inflection regex for #singularize so short inflections like ors do not affect larger words like sponsors [#6093 state:resolved] --- activesupport/lib/active_support/inflector/inflections.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/inflector/inflections.rb b/activesupport/lib/active_support/inflector/inflections.rb index 3caf78bc7d..e136e4c5b3 100644 --- a/activesupport/lib/active_support/inflector/inflections.rb +++ b/activesupport/lib/active_support/inflector/inflections.rb @@ -148,7 +148,7 @@ module ActiveSupport def singularize(word) result = word.to_s.dup - if inflections.uncountables.any? { |inflection| result =~ /#{inflection}\Z/i } + if inflections.uncountables.any? { |inflection| result =~ /\b(#{inflection})\Z/i } result else inflections.singulars.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } -- cgit v1.2.3