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

Document changes to nearbys method.

parent ee670d37
Branches
Tags
No related merge requests found
...@@ -130,9 +130,11 @@ To find objects by location, use the following scopes: ...@@ -130,9 +130,11 @@ To find objects by location, use the following scopes:
With geocoded objects you can do things like this: With geocoded objects you can do things like this:
if obj.geocoded?
obj.nearbys(30) # other objects within 30 miles obj.nearbys(30) # other objects within 30 miles
obj.distance_from([40.714,-100.234]) # distance from arbitrary point to object obj.distance_from([40.714,-100.234]) # distance from arbitrary point to object
obj.bearing_to("Paris, France") # direction from object to arbitrary point obj.bearing_to("Paris, France") # direction from object to arbitrary point
end
Some utility methods are also available: Some utility methods are also available:
......
...@@ -58,6 +58,7 @@ module Geocoder ...@@ -58,6 +58,7 @@ module Geocoder
## ##
# Get nearby geocoded objects. # Get nearby geocoded objects.
# Takes the same options hash as the near class method (scope). # Takes the same options hash as the near class method (scope).
# Returns nil if the object is not geocoded.
# #
def nearbys(radius = 20, options = {}) def nearbys(radius = 20, options = {})
return nil unless geocoded? return nil unless geocoded?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment