aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/dependencies/zeitwerk_integration.rb')
-rw-r--r--activesupport/lib/active_support/dependencies/zeitwerk_integration.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb b/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
index 821e3f971e..2cf55713bd 100644
--- a/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
+++ b/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
@@ -28,7 +28,7 @@ module ActiveSupport
end
def autoloaded?(object)
- cpath = object.is_a?(Module) ? object.name : object.to_s
+ cpath = object.is_a?(Module) ? real_mod_name(object) : object.to_s
Rails.autoloaders.main.unloadable_cpath?(cpath)
end
@@ -42,6 +42,17 @@ module ActiveSupport
end
end
+ module RequireDependency
+ def require_dependency(filename)
+ filename = filename.to_path if filename.respond_to?(:to_path)
+ if abspath = ActiveSupport::Dependencies.search_for_file(filename)
+ require abspath
+ else
+ require filename
+ end
+ end
+ end
+
module Inflector
def self.camelize(basename, _abspath)
basename.camelize
@@ -90,7 +101,7 @@ module ActiveSupport
def decorate_dependencies
Dependencies.unhook!
Dependencies.singleton_class.prepend(Decorations)
- Object.class_eval { alias_method :require_dependency, :require }
+ Object.prepend(RequireDependency)
end
end
end