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

[#64348] Use self.class for scoping

Tobias Dillmann633dba465bb7
diff --git a/app/models/custom_field/calculated_value.rb b/app/models/custom_field/calculated_value.rb
index 94da6578a97..4c15ea77c3a 100644
--- a/app/models/custom_field/calculated_value.rb
+++ b/app/models/custom_field/calculated_value.rb
@@ -73,9 +73,7 @@ module CustomField::CalculatedValue
end
def usable_custom_field_references_for_formula
- scope = type == "ProjectCustomField" ? ProjectCustomField : CustomField
-
- scope
+ self.class
.where(field_format: FIELD_FORMATS_FOR_FORMULA)
# Disallow the current custom field to avoid circular references
.where.not(id: id)