From 0b744d48fdc84445f593114fe61baaafca4e17f4 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 17 Oct 2017 12:28:35 +0200 Subject: Fixes: #4727@0.1h; Added organisation to clone for and rebased master --- lib/compliance_control_set_cloner.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/compliance_control_set_cloner.rb b/lib/compliance_control_set_cloner.rb index 3856ce25e..1cf58a38d 100644 --- a/lib/compliance_control_set_cloner.rb +++ b/lib/compliance_control_set_cloner.rb @@ -4,10 +4,11 @@ class ComplianceControlSetCloner # abbreviate compliance_control to cc and # compliance_check to cck iff used as prefixes. - attr_reader :source_set_id - - def copy source_set_id + attr_reader :organisation_id, :source_set_id + + def copy source_set_id, organisation_id @source_set_id = source_set_id + @organisation_id = organisation_id copy_set end @@ -71,12 +72,15 @@ class ComplianceControlSetCloner # Lazy Values # ----------- + def organisation + @__organisation__ ||= Organisation.find(organisation_id) + end def source_set @__source_set__ ||= ComplianceControlSet.find(source_set_id) end def target_set @__target_set__ ||= ComplianceControlSet.create!( - organisation: source_set.organisation, + organisation: organisation, name: name_of_copy(:compliance_control_sets, source_set.name) ) end -- cgit v1.2.3