alexreisner/geocoder — pull request #147 by dwilkie (2011-12-04 06:16:42+00:00)
Title: Allow ordering by association's distances

I just extracted out the distance calculations to allow you to queries like:

class User < ActiveRecord::Base
has_one :location

def find_nearbys(user)
scoped.joins(:location).order(Location.distance_from(user.location))
end
end

I also added a test in geocoder_test