Newbie to Rails. I am building an app where users create events at a certain location, and plan to host on heroku. Other users can view events taking place with开发者_如何学JAVAin x miles of their latitude/longitude. I'm looking for a solution that would help me fetch all events happening in an x mile radius. The options seem to be Geocoder and Geokit. Geokit seems to be more popular but doesn't seem to be ready for Rails 3. Is there an obvious choice for what I'm trying to do?
You should use MongoDB, which is provided via a Heroku addon. With Mongo you then have access to spacial queries ("find me all the events within this circle"): http://www.mongodb.org/display/DOCS/Geospatial+Indexing
Unfortunately if you try to use Postgres's geospacial indexing you will find that Heroku does not offer it by default.
Take a look at Mongoid which enables you to do ActiveRecord-style representations of your documents in Mongo, and is very easy to get going with.
精彩评论