From 924ef18d4bf8f82c18b8362f3e7aab9e60ba5826 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Thu, 17 Aug 2006 03:35:36 +0000 Subject: Detect missing_constants calls from removed modules and fail accordingly. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4780 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/dependencies.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 5f3c35839b..2d1649d22c 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -182,6 +182,10 @@ module Dependencies #:nodoc: # If we have an anonymous module, all we can do is attempt to load from Object. from_mod = Object if from_mod.name.empty? + unless qualified_const_defined?(from_mod.name) && from_mod.name.constantize.object_id == from_mod.object_id + raise ArgumentError, "A copy of #{from_mod} has been removed from the module tree but is still active!" + end + raise ArgumentError, "Expected #{from_mod} is not missing constant #{const_name}!" if from_mod.const_defined?(const_name) qualified_name = qualified_name_for from_mod, const_name -- cgit v1.2.3