class PoliciesController

def find_multiple

def find_multiple
  if params.key?(:host_names) || params.key?(:host_ids) || multiple_with_filter?
    @hosts = Host.search_for(params[:search]) if multiple_with_filter?
    @hosts ||= Host.merge(Host.where(id: params[:host_ids]).or(Host.where(name: params[:host_names])))
    if @hosts.empty?
      error _('No hosts were found with that id, name or query filter')
      redirect_to(hosts_path)
      return false
    end
  else
    error _('No hosts selected')
    redirect_to(hosts_path) && (return false)
  end
  return @hosts
rescue => e
  error _("Something went wrong while selecting hosts - %s") % e
  logger.debug e.message
  logger.debug e.backtrace.join("\n")
  redirect_to(hosts_path) && (return false)
end