提交 9a37fd44 编写于 作者: M Marcel Molina

Add plugin library directories to the load path after the lib directory so...

Add plugin library directories to the load path after the lib directory so that libraries in the lib directory get precedence. Closes #2910.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3122 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 f14625bb
*SVN*
* Add plugin library directories to the load path after the lib directory so that libraries in the lib directory get precedence. #2910. [james.adam@gmail.com]
* Make help for the console command more explicit about how to specify the desired environment in which to run the console. #2911. [anonymous]
* PostgreSQL: the purge_test_database Rake task shouldn't explicitly specify the template0 template when creating a fresh test database. #2964 [dreamer3@gmail.com]
......
......@@ -299,9 +299,13 @@ def load_plugin(directory)
has_lib = File.directory?(lib_path)
has_init = File.file?(init_path)
# Add lib to load path.
$LOAD_PATH.unshift(lib_path) if has_lib
# Add lib to load path *after* the application lib, to allow
# application libraries to override plugin libraries.
if has_lib
application_lib_index = $LOAD_PATH.index(File.join(RAILS_ROOT, "lib")) || 0
$LOAD_PATH.insert(application_lib_index + 1, lib_path)
end
# Allow plugins to reference the current configuration object
config = configuration
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册