I was just about to submit the following ticket including a patch for Rails 2.0. But then I noticed that this behaviour hasn't been invented with the recent refactorings of the plugin loading mechanism but was already there in Rails 1.2.x: http://dev.rubyonrails.org/browser/tags/rel_1-2-6/railties/lib/initializer.rb#L393
Therefor I thought it might make more sense to submit this to the mailinglist first for discussion.
So, is there a particular reason for this behaviour?
# Different order of plugin load_paths in $LOAD_PATHS and Dependencies
In Rails::Plugin::Loader#add_plugin_load_paths paths are inserted into $LOAD_PATHS in reverse alphabetical order so that plugins loaded later will take precedence over plugins loaded earlier. (This has been described as the intended behaviour here: http://www.ruby-forum.com/topic/133009)
However these paths are appended to Dependencies.load_paths and Dependencies.load_once_paths so they will appear in alphabetical order in these array.
So in effect if there are two files with the same name in two different plugins like these ...
... require 'something' will load the one with latter file while using Dependencies constant autoloading will load the former file:
require 'something' # loads /plugins/plugin_b/lib/something.rb (correct)
Something # loads /plugins/plugin_a/lib/something.rb (wrong)
plugin_loader_load_paths_order.diff (1.12 KB)
plugin_loader_test_load_paths_order.diff (2.94 KB)