diff options
author | Jonathan del Strother <jon.delStrother@audioboo.fm> | 2011-08-24 17:30:50 +0100 |
---|---|---|
committer | Jonathan del Strother <jon.delStrother@audioboo.fm> | 2011-08-24 18:14:25 +0100 |
commit | e0714ee005a366aa92449fc4f92cf97aa8e2f349 (patch) | |
tree | aa4df7b0395e95602561faff609a1a80d127704d /activesupport/lib | |
parent | 976b2be1085aa22f84c6fcbe40ba25ba4f89051c (diff) | |
download | rails-e0714ee005a366aa92449fc4f92cf97aa8e2f349.tar.gz rails-e0714ee005a366aa92449fc4f92cf97aa8e2f349.tar.bz2 rails-e0714ee005a366aa92449fc4f92cf97aa8e2f349.zip |
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
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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 |