From e0714ee005a366aa92449fc4f92cf97aa8e2f349 Mon Sep 17 00:00:00 2001 From: Jonathan del Strother Date: Wed, 24 Aug 2011 17:30:50 +0100 Subject: Fix autoload_once_paths when using Pathnames & ruby 1.9 Under ruby 1.9.2 - "/var/log".starts_with?(Pathname.new("/var")) # => false so setting config.autoload_once_paths with Pathnames would not work --- activesupport/lib/active_support/dependencies.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 6252e7f7c3..c072a8e646 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -421,7 +421,8 @@ module ActiveSupport #:nodoc: end def load_once_path?(path) - autoload_once_paths.any? { |base| path.starts_with? base } + # to_s works around a ruby1.9 issue where #starts_with?(Pathname) will always return false + autoload_once_paths.any? { |base| path.starts_with? base.to_s } end # Attempt to autoload the provided module name by searching for a directory -- cgit v1.2.3