From 5cff94fd851f23265b525fe9ce5489c0b28c771c Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 12 Feb 2012 16:57:47 -0800 Subject: [PATCH] inflection regexp are meant to be applied once --- activesupport/lib/active_support/inflector/methods.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 79070b4a35b..ddd2aca31d4 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -92,7 +92,7 @@ module ActiveSupport # "author_id" # => "Author" def humanize(lower_case_and_underscored_word) result = lower_case_and_underscored_word.to_s.dup - inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } + inflections.humans.each { |(rule, replacement)| break if result.sub!(rule, replacement) } result.gsub!(/_id$/, "") result.gsub!(/_/, ' ') result.gsub(/([a-z\d]*)/i) { |match| @@ -311,7 +311,7 @@ module ActiveSupport if word.empty? || inflections.uncountables.include?(result.downcase[/\b\w+\Z/]) result else - rules.each { |(rule, replacement)| break if result.gsub!(rule, replacement) } + rules.each { |(rule, replacement)| break if result.sub!(rule, replacement) } result end end