RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: paulmederos
Site: paulmederos.com
Old problem, but I was working on a similar problem. I solved it by using the "area" gem, and converting the zip code (passed as string) into a lat/long pair.
def self.nearest_to_zip zip, number_of_results locs = Location.near(zip.to_latlon, number_of_results, :active => true, :order => :distance) end
Old problem, but I was working on a similar problem. I solved it by using the "area" gem, and converting the zip code (passed as string) into a lat/long pair.