diff options
author | Arun Agrawal <arunagw@gmail.com> | 2013-06-14 17:51:36 +0200 |
---|---|---|
committer | Arun Agrawal <arunagw@gmail.com> | 2013-06-15 00:16:05 +0200 |
commit | 07d8294b943a7978f09720fac353498f462d716a (patch) | |
tree | b823b20e254bd330d3306895978591ebcb0c2a54 /activesupport | |
parent | 85bb7d9af16dafccd3c3d2394a75050951f8804c (diff) | |
download | rails-07d8294b943a7978f09720fac353498f462d716a.tar.gz rails-07d8294b943a7978f09720fac353498f462d716a.tar.bz2 rails-07d8294b943a7978f09720fac353498f462d716a.zip |
Changing const_regexp to check for constant name.
We need to return Regexp.escape(camel_cased_word)
if the split is blank.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/inflector/methods.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 665545db3b..9f417af826 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -322,6 +322,9 @@ module ActiveSupport # For instance, Foo::Bar::Baz will generate Foo(::Bar(::Baz)?)? def const_regexp(camel_cased_word) #:nodoc: parts = camel_cased_word.split("::") + + return Regexp.escape(camel_cased_word) if parts.blank? + last = parts.pop parts.reverse.inject(last) do |acc, part| |