Vote #74480
完了Project authorization EnabledModule N+1 queries
0%
説明
There's a problem with project authorization that causes N+1 queries (one per project in @projects).
In ApplicationController#authorize redmine checks authorization on
The problem here is that pluck circumvents preloading, so no matter wether we do @@projects = Project.includes(:enabled_modules).where(conditions)@ in a controller, it will still trigger one extra query per project.
Given that the EnableModule model is tiny, this could be prevented by using @enabled_modules.map(&:name)@ instead.
journals
Fixed in r12228, @#pluck@ won't be called is the association is preloaded.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Nice solution, I didn't know about @loaded?@ until now.
--------------------------------------------------------------------------------
Admin Redmine さんが3年以上前に更新
- カテゴリ を Code cleanup/refactoring_30 にセット
- 対象バージョン を 2.4.0_70 にセット