diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-09-06 20:31:28 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-09-06 20:31:28 +0000 |
commit | 93659978d50cd95936f81f38a57028cc68a235ee (patch) | |
tree | be05329cbab571b6663a387abdda014f72b3d438 /activesupport/lib | |
parent | 5a5f85d5bea6578e900d5af51a9a2706689d08aa (diff) | |
download | rails-93659978d50cd95936f81f38a57028cc68a235ee.tar.gz rails-93659978d50cd95936f81f38a57028cc68a235ee.tar.bz2 rails-93659978d50cd95936f81f38a57028cc68a235ee.zip |
Fix loadable_constants_for_path to handle load paths that do not end with a slash.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5053 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 1b027aa75b..4a4861220e 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -125,19 +125,18 @@ module Dependencies #:nodoc: expanded_path = File.expand_path(path) bases.collect do |root| - expanded_root = File.expand_path root - next unless expanded_path.starts_with? expanded_root + expanded_root = File.expand_path(root) + next unless %r{\A#{Regexp.escape(expanded_root)}(/|\\)} =~ expanded_path nesting = expanded_path[(expanded_root.size)..-1] nesting = nesting[1..-1] if nesting && nesting[0] == ?/ next if nesting.blank? - names = [nesting.camelize] - - # Special case: application.rb might define ApplicationControlller. - names << 'ApplicationController' if nesting == 'application' - - names + [ + nesting.camelize, + # Special case: application.rb might define ApplicationControlller. + ('ApplicationController' if nesting == 'application') + ] end.flatten.compact.uniq end |