Skip to content
Snippets Groups Projects
Commit c4fc30d9 authored by Alex Reisner's avatar Alex Reisner
Browse files

Add distance_to method.

parent 892eab89
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,14 @@ module Geocoder
coords.split(',')[0...2].reverse.map{ |i| i.to_f }
end
##
# Calculate the distance from the object to a point (lat,lon). Valid units
# are defined in <tt>distance_between</tt> class method.
#
def distance_to(lat, lon, units = :mi)
Geocoder.distance_between(latitude, longitude, lat, lon, :units => units)
end
##
# Search Google based on the object's +location+ attribute.
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment