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

handle ifc_attachment already being loaded

ulferts6836febb928b
diff --git a/modules/ifc_models/app/models/ifc_models/ifc_model.rb b/modules/ifc_models/app/models/ifc_models/ifc_model.rb
index 3191d96e0a0..1d1a7c3c8ab 100644
--- a/modules/ifc_models/app/models/ifc_models/ifc_model.rb
+++ b/modules/ifc_models/app/models/ifc_models/ifc_model.rb
@@ -36,7 +36,11 @@ module IFCModels
##
# Delete the given named description
def get_attached_type(key)
- attachments.find_by_description(key.to_s)
+ if attachments.loaded?
+ attachments.detect { |a| a.description == key.to_s && !a.marked_for_destruction? }
+ else
+ attachments.find_by_description(key.to_s)
+ end
end
##