plugin_load_paths.patch

Florian Schwab, 2019-02-06 08:24

Download (1.17 KB)

View differences:

lib/redmine/plugin.rb
107 107
        ActionMailer::Base.prepend_view_path(view_path)
108 108
      end
109 109

  
110
      # Adds the app/{controllers,helpers,models} directories of the plugin to the autoload path
111
      Dir.glob File.expand_path(File.join(p.directory, 'app', '{controllers,helpers,models}')) do |dir|
112
        ActiveSupport::Dependencies.autoload_paths += [dir]
113
        Rails.application.config.eager_load_paths += [dir] if Rails.application.config.eager_load
114
      end
110
      # Add the plugin directories to rails autoload paths
111
      engine_cfg = Rails::Engine::Configuration.new(p.directory)
112
      Rails.application.config.eager_load_paths += engine_cfg.eager_load_paths
113
      Rails.application.config.autoload_once_paths += engine_cfg.autoload_once_paths
114
      Rails.application.config.autoload_paths += engine_cfg.autoload_paths
115
      ActiveSupport::Dependencies.autoload_paths += engine_cfg.eager_load_paths + engine_cfg.autoload_once_paths + engine_cfg.autoload_paths
115 116

  
116 117
      # Defines plugin setting if present
117 118
      if p.settings