Patch #30725

Plugin eager_load should depend on environment setting instead of name

Added by Florian Schwab 9 months ago. Updated 9 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Rails support
Target version:4.0.2

Description

Currently the app directories are added to the eager_load paths if the environment name is production.

see: source:trunk/lib/redmine/plugin.rb@17293#96

The decision to add the path to the eager_load paths should depend on the_ eager_load_ setting (Rails.application.config.eager_load) instead of the environment name.
Rails 5 disables autoloading in case eager_load is enabled so using a different environment (e.g. staging) that also enables eager_load will result in plugin classes (e.g. models) are not loaded (uninitialized constant) in this environment.

The attached patch fixes this to use the eager_load setting to decide if the paths should be added to eager_load.

plugin_eager_load.patch Magnifier (692 Bytes) Marius BALTEANU, 2019-01-31 12:14


Related issues

Related to Redmine - Defect #26636: Rails 5: "Page not found" error when accessing a page of ... Closed
Related to Redmine - Defect #30753: Plugins auto_load and eager_load paths Closed

Associated revisions

Revision 17841
Added by Go MAEDA 9 months ago

Plugin eager_load should depend on environment setting instead of name (#30725).

Patch by Florian Schwab.

Revision 17842
Added by Go MAEDA 9 months ago

Merged r17841 from trunk to 4.0-stable (#30725).

History

#1 Updated by Florian Schwab 9 months ago

Sorry, I forgot to change the tracker to Patch.

#2 Updated by Go MAEDA 9 months ago

  • Tracker changed from Defect to Patch

#4 Updated by Marius BALTEANU 9 months ago

Fixed the extension name in order to be able to preview the patch in browser.

#5 Updated by Marius BALTEANU 9 months ago

  • File deleted (plugin_eager_load.path)

#6 Updated by Go MAEDA 9 months ago

  • Category set to Rails support
  • Target version set to 4.0.2

Setting the target version to 4.0.2.

#7 Updated by Go MAEDA 9 months ago

  • Related to Defect #26636: Rails 5: "Page not found" error when accessing a page of a plugin in production mode added

#8 Updated by Go MAEDA 9 months ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA

Committed. Thank you for detecting and fixing the issue.

#9 Updated by Go MAEDA 9 months ago

  • Status changed from Resolved to Closed

#10 Updated by Go MAEDA 8 months ago

  • Related to Defect #30753: Plugins auto_load and eager_load paths added

Also available in: Atom PDF