diff --git a/app/models/miq_request_workflow.rb b/app/models/miq_request_workflow.rb index 7ae9cff72cd..81a2f4c9612 100644 --- a/app/models/miq_request_workflow.rb +++ b/app/models/miq_request_workflow.rb @@ -1046,7 +1046,7 @@ def allowed_hosts_obj(options = {}) return [] if hosts_ids.blank? # Remove any hosts that are no longer in the list - all_hosts = load_ar_obj(src[:ems]).hosts.find_all { |h| hosts_ids.include?(h.id) } + all_hosts = load_ar_obj(src[:ems]).hosts.where(:id => hosts_ids) allowed_hosts_obj_cache = process_filter(:host_filter, Host, all_hosts) _log.info("allowed_hosts_obj returned [#{allowed_hosts_obj_cache.length}] objects in [#{Time.now - st}] seconds") rails_logger('allowed_hosts_obj', 1)