diff options
author | Go MAEDA <maeda@farend.jp> | 2019-03-04 11:33:21 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-03-04 11:33:21 +0000 |
commit | 49b1aeee59d6d7eaa3504cde74d1954c92907086 (patch) | |
tree | 09da70f50bff99a0a4d236b134c7fb4eed5e1700 /lib/redmine | |
parent | 29d27d9cc936e6f16c4628f1c879025b6abd76d4 (diff) | |
download | redmine-49b1aeee59d6d7eaa3504cde74d1954c92907086.tar.gz redmine-49b1aeee59d6d7eaa3504cde74d1954c92907086.zip |
Add plugin directories to rails autoload paths (#30753).
Patch by Florian Schwab.
git-svn-id: http://svn.redmine.org/redmine/trunk@17923 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/plugin.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 4de7c4386..82bcde81f 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -107,11 +107,12 @@ module Redmine ActionMailer::Base.prepend_view_path(view_path) end - # Adds the app/{controllers,helpers,models} directories of the plugin to the autoload path - Dir.glob File.expand_path(File.join(p.directory, 'app', '{controllers,helpers,models}')) do |dir| - ActiveSupport::Dependencies.autoload_paths += [dir] - Rails.application.config.eager_load_paths += [dir] if Rails.application.config.eager_load - end + # Add the plugin directories to rails autoload paths + engine_cfg = Rails::Engine::Configuration.new(p.directory) + Rails.application.config.eager_load_paths += engine_cfg.eager_load_paths + Rails.application.config.autoload_once_paths += engine_cfg.autoload_once_paths + Rails.application.config.autoload_paths += engine_cfg.autoload_paths + ActiveSupport::Dependencies.autoload_paths += engine_cfg.eager_load_paths + engine_cfg.autoload_once_paths + engine_cfg.autoload_paths # Defines plugin setting if present if p.settings |