From 4ba8e3a3baa4ab8a89c4ced1fa18fddb0c69498f Mon Sep 17 00:00:00 2001 From: Jerome Pratt Date: Tue, 22 Oct 2024 10:04:49 +0100 Subject: [PATCH] [RUBY-3387] Rephrase comment to specify that all attributes and embedded relations will be copied by default --- .../safe_copy_attributes_service.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/services/waste_carriers_engine/safe_copy_attributes_service.rb b/app/services/waste_carriers_engine/safe_copy_attributes_service.rb index f485f469c..c3905f99a 100644 --- a/app/services/waste_carriers_engine/safe_copy_attributes_service.rb +++ b/app/services/waste_carriers_engine/safe_copy_attributes_service.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true module WasteCarriersEngine - # This responsible for safely copying attributes from a source instance of - # one class to a new instance of the targeted class. It ensures that only attributes - # that are defined in the target class are copied, excluding any specified attributes. - # The service also handles embedded relations recursively, processing nested - # attributes according to the target class definitions. + # This responsible for safely copying attributes and embedded relations from a source instance of + # one class to a new instance of the targeted class. By default it will copy every attribute except _id + # and every embedded relation that are defined in the target class. However, both attributes and embedded + # relations can be excluded by passing them into the attributes_to_exclude argument + # Embedded relations are processed recursively, and attributes to exclude + # will be applied to the embedded relations as well. class SafeCopyAttributesService def self.run(source_instance:, target_class:, attributes_to_exclude: [])