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

Geocoder#fetch_and_assign_coordinates: explicitly return coordinates array or nil.

parent d7b479f0
No related branches found
No related tags found
No related merge requests found
...@@ -46,13 +46,16 @@ module Geocoder ...@@ -46,13 +46,16 @@ module Geocoder
if c = fetch_coordinates(attribute) if c = fetch_coordinates(attribute)
self.latitude = c[0] self.latitude = c[0]
self.longitude = c[1] self.longitude = c[1]
return c
else
return nil
end end
end end
## ##
# Calculate the distance between two points (Haversine formula). Takes two # Calculate the distance between two points (Haversine formula). Takes two
# sets of coordinates and an options hash: # sets of coordinates and an options hash:
# #
# :units : <tt>:mi</tt> for miles (default), <tt>:km</tt> for kilometers # :units : <tt>:mi</tt> for miles (default), <tt>:km</tt> for kilometers
# #
def self.distance_between(lat1, lon1, lat2, lon2, options = {}) def self.distance_between(lat1, lon1, lat2, lon2, options = {})
......
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