diff --git a/app/models/ems_refresh/save_inventory_network.rb b/app/models/ems_refresh/save_inventory_network.rb index fa7c7f10472..3c476e47f5c 100644 --- a/app/models/ems_refresh/save_inventory_network.rb +++ b/app/models/ems_refresh/save_inventory_network.rb @@ -405,12 +405,8 @@ def save_load_balancer_health_check_members_inventory(load_balancer_health_check def link_cloud_subnets_to_network_routers(hashes) return if hashes.blank? - cloud_subnets = CloudSubnet.where(:id => hashes.map { |x| x[:id] }.compact.uniq).find_each.index_by(&:id) - hashes.each do |hash| - network_router = hash.fetch_path(:network_router, :id) - cloud_subnet = cloud_subnets[hash[:id]] - cloud_subnet.update_attributes(:network_router_id => network_router) if cloud_subnet + CloudSubnet.where(:id => hash[:id]).update_all(:network_router_id => hash.fetch_path(:network_router, :id)) end end end