Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Refactoring as suggested by @dombesz

jjabari-op442eb03cdc6d
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb
index 9a34b25614f..b35ed052dd1 100644
--- a/app/controllers/custom_fields_controller.rb
+++ b/app/controllers/custom_fields_controller.rb
@@ -38,9 +38,7 @@ class CustomFieldsController < ApplicationController
def index
# loading wp cfs exclicity to allow for eager loading
@custom_fields_by_type = CustomField.all
- .where.not(type: 'WorkPackageCustomField')
- # ProjectCustomFields now managed in a different UI
- .tap { |query| query.where.not(type: 'ProjectCustomField') }
+ .where.not(type: ['WorkPackageCustomField', 'ProjectCustomField'])
.group_by { |f| f.class.name }
@custom_fields_by_type['WorkPackageCustomField'] = WorkPackageCustomField.includes(:types).all