diff options
author | Matthew Draper <matthew@trebex.net> | 2014-10-04 08:15:41 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-10-04 08:16:55 +0930 |
commit | cf662783016462ce03ffbf76d09ad826ef5242ba (patch) | |
tree | b07878b13c05d2a13bae6439f7a9db238eecc171 /activesupport/lib/active_support/inflector/methods.rb | |
parent | 657ce17868b0eba89680b8e215fded0e3d53a685 (diff) | |
parent | 6a8464fa4f50a0fce3ce245f717b813712ea27a8 (diff) | |
download | rails-cf662783016462ce03ffbf76d09ad826ef5242ba.tar.gz rails-cf662783016462ce03ffbf76d09ad826ef5242ba.tar.bz2 rails-cf662783016462ce03ffbf76d09ad826ef5242ba.zip |
Merge pull request #14146 from chewi/fix-underscore-acronyms-regex
Fix underscore inflector handling of namespaced and adjacent acronyms
Diffstat (limited to 'activesupport/lib/active_support/inflector/methods.rb')
-rw-r--r-- | activesupport/lib/active_support/inflector/methods.rb | 2 |
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 f35e71ce81..5b75dd65d0 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -91,7 +91,7 @@ module ActiveSupport def underscore(camel_cased_word) return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/ word = camel_cased_word.to_s.gsub('::', '/') - word.gsub!(/(?:([A-Za-z\d])|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1}#{$1 && '_'}#{$2.downcase}" } + word.gsub!(/(?<=([A-Za-z\d])|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'}#{$2.downcase}" } word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2') word.gsub!(/([a-z\d])([A-Z])/,'\1_\2') word.tr!("-", "_") |