From a78042cee10b014f1942ebd104d484b4233e823c Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Wed, 10 Jan 2024 15:48:36 +1100 Subject: [PATCH] Remove save after adding an association with << `<<` operator already save the the association to the database --- .../dfc_provider/enterprise_groups/affiliated_by_controller.rb | 2 -- .../spec/requests/enterprise_groups/affiliated_by_spec.rb | 1 - 2 files changed, 3 deletions(-) diff --git a/engines/dfc_provider/app/controllers/dfc_provider/enterprise_groups/affiliated_by_controller.rb b/engines/dfc_provider/app/controllers/dfc_provider/enterprise_groups/affiliated_by_controller.rb index 7813a1bcea..acb5ad6898 100644 --- a/engines/dfc_provider/app/controllers/dfc_provider/enterprise_groups/affiliated_by_controller.rb +++ b/engines/dfc_provider/app/controllers/dfc_provider/enterprise_groups/affiliated_by_controller.rb @@ -17,8 +17,6 @@ module DfcProvider group.enterprises << enterprise - return head :unprocessable_entity unless group.save - head :created end diff --git a/engines/dfc_provider/spec/requests/enterprise_groups/affiliated_by_spec.rb b/engines/dfc_provider/spec/requests/enterprise_groups/affiliated_by_spec.rb index 65bffa8427..4230fe2b29 100644 --- a/engines/dfc_provider/spec/requests/enterprise_groups/affiliated_by_spec.rb +++ b/engines/dfc_provider/spec/requests/enterprise_groups/affiliated_by_spec.rb @@ -82,7 +82,6 @@ describe "EnterpriseGroups::AffiliatedBy", type: :request, swagger_doc: "dfc.yam response "204", "no content" do before do group.enterprises << enterprise2 - group.save! end it "removes enterperise from group" do |example|