aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/dependencies.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 47f791e331..3559f715d5 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Chain the const_missing hook to any previously existing hook so rails can play nicely with rake
+
* Clean logger is compatible with both 1.8.2 and 1.8.3 Logger. #2263 [Michael Schuerig <michael@schuerig.de>]
* Added native, faster implementations of .blank? for the core types #2286 [skae]
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