aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-10-03 15:28:08 +0000
committerJamis Buck <jamis@37signals.com>2005-10-03 15:28:08 +0000
commit33f78d822759aed125b2fb8fe0a9b3a5704d3239 (patch)
tree35054b56cbee2d645cc839c3cd2bd30a5bdfcbc0 /activesupport/lib/active_support/dependencies.rb
parentf13534e65fa45a451ec0ba2df6335bec7b5d661d (diff)
downloadrails-33f78d822759aed125b2fb8fe0a9b3a5704d3239.tar.gz
rails-33f78d822759aed125b2fb8fe0a9b3a5704d3239.tar.bz2
rails-33f78d822759aed125b2fb8fe0a9b3a5704d3239.zip
Chain the const_missing hook to any previously existing hook so rails can play nicely with rake
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2440 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/dependencies.rb')
-rw-r--r--activesupport/lib/active_support/dependencies.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 78e445afe4..87883542a8 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -178,6 +178,9 @@ Object.send(:define_method, :require_dependency) { |file_name| Dependencies.dep
Object.send(:define_method, :require_association) { |file_name| Dependencies.associate_with(file_name) } unless Object.respond_to?(:require_association)
class Module #:nodoc:
+ # Rename the original handler so we can chain it to the new one
+ alias :rails_original_const_missing :const_missing
+
# Use const_missing to autoload associations so we don't have to
# require_association when using single-table inheritance.
def const_missing(class_id)
@@ -189,7 +192,11 @@ class Module #:nodoc:
require_dependency(class_id.to_s.demodulize.underscore)
if Object.const_defined?(class_id) then return Object.const_get(class_id) else raise LoadError end
rescue LoadError => e
- raise NameError.new("uninitialized constant #{class_id}").copy_blame!(e)
+ begin
+ rails_original_const_missing(class_id)
+ rescue Exception
+ raise NameError.new("uninitialized constant #{class_id}").copy_blame!(e)
+ end
end
end
end