diff --git a/app/models/vm_or_template.rb b/app/models/vm_or_template.rb index 41e6f3d9340b..ecd27801745e 100644 --- a/app/models/vm_or_template.rb +++ b/app/models/vm_or_template.rb @@ -529,9 +529,17 @@ def genealogy_parent end def genealogy_parent=(parent) - @genealogy_parent_object = parent + with_relationship_type('genealogy') do + if use_ancestry? + self.parent = parent + else + @genealogy_parent_object = parent + end + end end + # only necessary for relationships using genealogy + # delete when using ancestry def save_genealogy_information if defined?(@genealogy_parent_object) && @genealogy_parent_object with_relationship_type('genealogy') { self.parent = @genealogy_parent_object }