Skip to content

Commit 86faeb8

Browse files
committed
Fix (Inflector::Methods#underscore): small regression
1 parent 18922cc commit 86faeb8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

activesupport/lib/active_support/inflector/methods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def underscore(camel_cased_word)
9797
return camel_cased_word.to_s unless /[A-Z-]|::/.match?(camel_cased_word)
9898
word = camel_cased_word.to_s.gsub("::", "/")
9999
word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" }
100-
word.gsub!(/([A-Z\d]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { ($1 || $2) << "_" }
100+
word.gsub!(/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { ($1 || $2) << "_" }
101101
word.tr!("-", "_")
102102
word.downcase!
103103
word

activesupport/test/inflector_test_cases.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ module InflectorTestCases
121121
"ApplicationController" => "application_controller",
122122
"Area51Controller" => "area51_controller",
123123
"AppCDir" => "app_c_dir",
124+
"Accountsv2N2Test" => "accountsv2_n2_test",
124125
}
125126

126127
UnderscoreToLowerCamel = {

0 commit comments

Comments
 (0)