I am trying to figure out how to write the equivalent of this query in ActiveRecord:
SELECT id FROM projects, neighborhoods
WHERE ST_WITHIN(projects.lonlat, neighorhoods.the_geom);
I tried several approaches, including
Neighborhood.select(:id).from('projects').where("ST_WITHIN(projects.lonlat, neighorhoods.the_geom)")
But the resulting query always resolves to a single table. Can anyone help me out?