プロジェクト

全般

プロフィール

Vote #79808

完了

Plugin eager_load should depend on environment setting instead of name

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Rails support_44
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
44
version_id:
146
issue_org_id:
30725
author_id:
13681
assigned_to_id:
332
comments:
10
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.


journals

Sorry, I forgot to change the tracker to *Patch*.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
Setting the target version to 4.0.2.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed. Thank you for detecting and fixing the issue.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,26636,Rails 5: "Page not found" error when accessing a page of a plugin in production mode
relates,Closed,30753,Plugins auto_load and eager_load paths

Admin Redmine さんが約4年前に更新

  • カテゴリRails support_44 にセット
  • 対象バージョン4.0.2_146 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0