diff --git a/README.md b/README.md index 91cccb9833bcbd867de55246cf16987d07c79b99..1cabb3549ae18830f9630c733006bd13c2e9aea7 100644 --- a/README.md +++ b/README.md @@ -130,9 +130,11 @@ To find objects by location, use the following scopes: With geocoded objects you can do things like this: - obj.nearbys(30) # other objects within 30 miles - obj.distance_from([40.714,-100.234]) # distance from arbitrary point to object - obj.bearing_to("Paris, France") # direction from object to arbitrary point + if obj.geocoded? + obj.nearbys(30) # other objects within 30 miles + obj.distance_from([40.714,-100.234]) # distance from arbitrary point to object + obj.bearing_to("Paris, France") # direction from object to arbitrary point + end Some utility methods are also available: diff --git a/lib/geocoder/stores/base.rb b/lib/geocoder/stores/base.rb index 4502f371c8ffd7b1750d5b8163d76c6ff9ee6b7b..bccdf008f4d97810f64ca151b8da06067d04f013 100644 --- a/lib/geocoder/stores/base.rb +++ b/lib/geocoder/stores/base.rb @@ -58,6 +58,7 @@ module Geocoder ## # Get nearby geocoded objects. # Takes the same options hash as the near class method (scope). + # Returns nil if the object is not geocoded. # def nearbys(radius = 20, options = {}) return nil unless geocoded?