From c4e15d9badef11ae9155c1cd1d071168abf4714b Mon Sep 17 00:00:00 2001 From: Esdras Vidal Date: Tue, 4 Sep 2018 17:07:21 -0300 Subject: [PATCH] Fixing Computer System association on Physical Storage --- app/models/ems_refresh/save_inventory_physical_infra.rb | 2 +- app/models/physical_storage.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/ems_refresh/save_inventory_physical_infra.rb b/app/models/ems_refresh/save_inventory_physical_infra.rb index 4875d9c54666..2e5d2ee5c4de 100644 --- a/app/models/ems_refresh/save_inventory_physical_infra.rb +++ b/app/models/ems_refresh/save_inventory_physical_infra.rb @@ -101,7 +101,7 @@ def save_physical_storages_inventory(ems, hashes, target = nil) h[:physical_chassis_id] = h.delete(:physical_chassis).try(:[], :id) end - child_keys = %i(computer_system asset_detail physical_disk canister) + child_keys = %i(asset_detail physical_disk canister) save_inventory_multi(ems.physical_storages, hashes, deletes, [:ems_ref], child_keys) store_ids_for_new_records(ems.physical_storages, hashes, :ems_ref) end diff --git a/app/models/physical_storage.rb b/app/models/physical_storage.rb index 9c7ea8e7bf97..cf997ff3c3b0 100644 --- a/app/models/physical_storage.rb +++ b/app/models/physical_storage.rb @@ -9,11 +9,11 @@ class PhysicalStorage < ApplicationRecord has_one :asset_detail, :as => :resource, :dependent => :destroy, :inverse_of => false has_many :canisters, :dependent => :destroy, :inverse_of => false - has_many :computer_system, :through => :canisters - has_many :hardware, :through => :computer_system - has_many :guest_devices, :through => :canisters - has_many :physical_disks, :dependent => :destroy, :inverse_of => :physical_storage + + has_one :computer_system, :through => :canisters + + has_many :canister_computer_systems, :through => :canisters, :source => :computer_system supports :refresh_ems