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

Fixed model relation definitions

Jonas Jabari3304f542676f
diff --git a/app/models/project_custom_field.rb b/app/models/project_custom_field.rb
index 91fd0bf2c6a..bf83af7b4b0 100644
--- a/app/models/project_custom_field.rb
+++ b/app/models/project_custom_field.rb
@@ -27,8 +27,9 @@
#++
class ProjectCustomField < CustomField
- belongs_to :project_custom_field_section, class_name: 'ProjectCustomFieldSection', foreign_key: :custom_field_section_id
- has_many :project_custom_field_project_mappings, class_name: 'ProjectCustomFieldProjectMapping', foreign_key: :custom_field_id,
+ belongs_to :project_custom_field_section, class_name: "ProjectCustomFieldSection", foreign_key: :custom_field_section_id,
+ inverse_of: :custom_fields
+ has_many :project_custom_field_project_mappings, class_name: "ProjectCustomFieldProjectMapping", foreign_key: :custom_field_id,
dependent: :destroy, inverse_of: :project_custom_field
acts_as_list column: :position_in_custom_field_section, scope: [:custom_field_section_id]
diff --git a/app/models/project_custom_field_section.rb b/app/models/project_custom_field_section.rb
index 22a9ef3114e..c88ef5f11b1 100644
--- a/app/models/project_custom_field_section.rb
+++ b/app/models/project_custom_field_section.rb
@@ -27,5 +27,6 @@
#++
class ProjectCustomFieldSection < CustomFieldSection
- has_many :custom_fields, class_name: "ProjectCustomField", dependent: :destroy
+ has_many :custom_fields, class_name: "ProjectCustomField", dependent: :destroy, foreign_key: :custom_field_section_id,
+ inverse_of: :project_custom_field_section
end