Fixes #1457: support using AR relations as input.