RailsCasts Pro episodes are now free!

Learn more or hide this

Paul Mederos's Profile

GitHub User: paulmederos

Site: paulmederos.com

Comments by Paul Mederos


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)