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
This commit is contained in:
Jean-Philippe Lang 2013-10-20 16:04:04 +00:00
parent 99bf8c95ab
commit b48fcdaa97
1 changed files with 1 additions and 1 deletions

View File

@ -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