Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/concepts/project/operations/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def persist_changes(response)
return if response.failure?

ActiveRecord::Base.transaction do
response[:project].save!
response[:project].components.where(id: response[:component_ids_to_delete]).destroy_all
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because update_component_attributes enumerates response[:project].components, the association is loaded before persist_changes. Calling components.where(...).destroy_all may not reliably remove those destroyed records from the already-loaded association cache, so project.save! can still validate the destroyed components and fail (potentially keeping the Sentry error). Prefer deleting via the association proxy (e.g., response[:project].components.destroy(response[:component_ids_to_delete])) or otherwise ensuring the in-memory collection no longer contains the records being deleted before save! runs validations.

Suggested change
response[:project].components.where(id: response[:component_ids_to_delete]).destroy_all
response[:project].components.destroy(response[:component_ids_to_delete])

Copilot uses AI. Check for mistakes.
response[:project].save!
end
end
end
Expand Down
Loading