you can also do where(:ip => [vm.public_ip_address, vm.private_ip_address])

assuming there is only one host with those ips, it should work.