Hello,
I have experience with PostgreSQL and PostGIS however I don't have experience with Ruby, though that may not be an issue since the Ruby code should just build the query and receive the response. I can help you build the query.
What data does your database contain?
Best wishes,
iticus