diff options
-rw-r--r-- | app/controllers/custom_fields_controller.rb | 2 | ||||
-rw-r--r-- | app/views/custom_fields/_index.html.erb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index 26e9b044d..71e4394f5 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -28,6 +28,8 @@ class CustomFieldsController < ApplicationController respond_to do |format| format.html { @custom_fields_by_type = CustomField.all.group_by {|f| f.class.name } + @custom_fields_projects_count = + IssueCustomField.where(is_for_all: false).joins(:projects).group(:custom_field_id).count } format.api { @custom_fields = CustomField.all diff --git a/app/views/custom_fields/_index.html.erb b/app/views/custom_fields/_index.html.erb index 7a5d37283..0a5ff3ee1 100644 --- a/app/views/custom_fields/_index.html.erb +++ b/app/views/custom_fields/_index.html.erb @@ -18,7 +18,7 @@ <td><%= checked_image custom_field.is_required? %></td> <% if tab[:name] == 'IssueCustomField' %> <td><%= checked_image custom_field.is_for_all? %></td> - <td><%= l(:label_x_projects, :count => custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td> + <td><%= l(:label_x_projects, :count => @custom_fields_projects_count[custom_field.id]) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td> <% end %> <td class="buttons"> <%= reorder_handle(custom_field, :url => custom_field_path(custom_field), :param => 'custom_field') %> |