Skip to content

Instantly share code, notes, and snippets.

@nviennot
Created May 19, 2015 16:52
Show Gist options
  • Save nviennot/20b9df877cac6ea3c9bc to your computer and use it in GitHub Desktop.
Save nviennot/20b9df877cac6ea3c9bc to your computer and use it in GitHub Desktop.
def controller_action
center = some_point
models = Model.where(:location.near => {:point => center :max_distance => 100})
render :json => models.map { |m| :distance => SomeGeoGem.distance(m.location, center), :name => m.name }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment