When in the rails console the following code prints to screen an array of coordinates in geojson format as I expect it to:
Bg.
select("bg_id, ST_AsGeoJSON(the_geom) as my_geo").
where("ST_Contains(ST_MakeEnvelope(-xxx,xxx,-xxx,xxx, 4269), bg.the_geom)").
map(&:my_geo)
The select portion however isn't just asking for the json. What if I would also like the bg_id's in the array too?