diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-26 15:23:11 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-26 15:23:11 -0700 |
commit | 6089ecf93187fbd47c7b3f11b58c88f0de09940a (patch) | |
tree | d7f03a2d33e5929a1b3f0dd13cac07a792d74450 | |
parent | b4efff4bac1c66e5af24de86cdb69a058ccf4147 (diff) | |
parent | f17ea60f98f9049f2b0aaeeaf40ce9ad79ce824c (diff) | |
download | rails-6089ecf93187fbd47c7b3f11b58c88f0de09940a.tar.gz rails-6089ecf93187fbd47c7b3f11b58c88f0de09940a.tar.bz2 rails-6089ecf93187fbd47c7b3f11b58c88f0de09940a.zip |
Merge pull request #2279 from jdelStrother/load_missing_constant
Constantize a regexp in Dependencies#load_missing_constant
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index d1543c4c58..a60697cb12 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -466,6 +466,7 @@ module ActiveSupport #:nodoc: # Load the constant named +const_name+ which is missing from +from_mod+. If # it is not possible to load the constant into from_mod, try its parent module # using const_missing. + THIS_FILE = %r{#{Regexp.escape(__FILE__)}} def load_missing_constant(from_mod, const_name) log_call from_mod, const_name @@ -478,7 +479,7 @@ module ActiveSupport #:nodoc: qualified_name = qualified_name_for from_mod, const_name path_suffix = qualified_name.underscore - trace = caller.reject {|l| l =~ %r{#{Regexp.escape(__FILE__)}}} + trace = caller.reject {|l| l =~ THIS_FILE} name_error = NameError.new("uninitialized constant #{qualified_name}") name_error.set_backtrace(trace) |