aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/inflector
diff options
context:
space:
mode:
authorJohn Paul Ashenfelter <johnpaul@transitionpoint.com>2010-11-30 13:48:25 -0500
committerPiotr Sarnacki <drogus@gmail.com>2010-12-22 09:44:46 +0100
commit9b4622a483319f3d1e7f4489442f0d86afb6da36 (patch)
treea0523dc7cc41524379d028f9e378ff6ca23f569b /activesupport/lib/active_support/inflector
parentbaebe7d0d5c82cc7bb0570ae7d17a947f9bf58f7 (diff)
downloadrails-9b4622a483319f3d1e7f4489442f0d86afb6da36.tar.gz
rails-9b4622a483319f3d1e7f4489442f0d86afb6da36.tar.bz2
rails-9b4622a483319f3d1e7f4489442f0d86afb6da36.zip
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]
Diffstat (limited to 'activesupport/lib/active_support/inflector')
-rw-r--r--activesupport/lib/active_support/inflector/inflections.rb2
1 files changed, 1 insertions, 1 deletions
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) }