aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/inflector/methods.rb
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxed.co>2017-11-06 14:46:42 +0000
committerAndrew White <andrew.white@unboxed.co>2017-11-06 14:47:47 +0000
commit0ddde0a8fca6a0ca3158e3329713959acd65605d (patch)
treeac41672e93e2ed1d3ae26dd3b427e688bc41c6b3 /activesupport/lib/active_support/inflector/methods.rb
parent7d1d6c4c0bde7364aeb66c22514a78bd9f8f1ecd (diff)
downloadrails-0ddde0a8fca6a0ca3158e3329713959acd65605d.tar.gz
rails-0ddde0a8fca6a0ca3158e3329713959acd65605d.tar.bz2
rails-0ddde0a8fca6a0ca3158e3329713959acd65605d.zip
Fix acronym support in `humanize`
Acronym inflections are stored with lowercase keys in the hash but the match wasn't being lowercased before being looked up in the hash. This shouldn't have any performance impact because before it would fail to find the acronym and perform the `downcase` operation anyway. Fixes #31052.
Diffstat (limited to 'activesupport/lib/active_support/inflector/methods.rb')
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb
index 72de42b1c3..3357b5eb32 100644
--- a/activesupport/lib/active_support/inflector/methods.rb
+++ b/activesupport/lib/active_support/inflector/methods.rb
@@ -138,7 +138,7 @@ module ActiveSupport
result.tr!("_".freeze, " ".freeze)
result.gsub!(/([a-z\d]*)/i) do |match|
- "#{inflections.acronyms[match] || match.downcase}"
+ "#{inflections.acronyms[match.downcase] || match.downcase}"
end
if capitalize