From 22d3fc19d55a7915380bcbb1dd687b791b9fcde7 Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Tue, 27 Nov 2012 14:59:58 -0500 Subject: [PATCH] Document changes to nearbys method. --- README.md | 8 +++++--- lib/geocoder/stores/base.rb | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 91cccb98..1cabb354 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 4502f371..bccdf008 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? -- GitLab