summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-10-20 16:04:04 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-10-20 16:04:04 +0000
commitb48fcdaa9769b9a62611062f0f03d47f92f4c34c (patch)
treea43c0f14fe4a13277c497bd5cd3e3d912b2be576 /app
parent99bf8c95aba29aa2cde30ba8ff39d4d8a37ae9e5 (diff)
downloadredmine-b48fcdaa9769b9a62611062f0f03d47f92f4c34c.tar.gz
redmine-b48fcdaa9769b9a62611062f0f03d47f92f4c34c.zip
Avoid a query if enabled_modules association is already loaded (#15058).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12228 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index e2b7a9d9e..d4f29453a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -961,7 +961,7 @@ class Project < ActiveRecord::Base
def allowed_permissions
@allowed_permissions ||= begin
- module_names = enabled_modules.pluck(:name)
+ module_names = enabled_modules.loaded? ? enabled_modules.map(&:name) : enabled_modules.pluck(:name)
Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name}
end
end