diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index 2b93753d0..5401bae65 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -102,6 +102,6 @@ class TrackersController < ApplicationController return end @trackers = Tracker.sorted.to_a - @custom_fields = IssueCustomField.all.sort + @custom_fields = IssueCustomField.sorted end end diff --git a/app/views/trackers/_form.html.erb b/app/views/trackers/_form.html.erb index 7b5b7ea61..3d71d7694 100644 --- a/app/views/trackers/_form.html.erb +++ b/app/views/trackers/_form.html.erb @@ -21,10 +21,11 @@
<%= hidden_field_tag 'tracker[core_fields][]', '' %> -<% if IssueCustomField.all.any? %> +<% @issue_custom_fields = IssueCustomField.sorted %> +<% if @issue_custom_fields.present? %>- <% IssueCustomField.all.each do |field| %> + <% @issue_custom_fields.each do |field| %>