geokit / geokit-rails

Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.
MIT License
1.57k stars 245 forks source link

Get the route passing close to 2 steps #100

Closed alain-andre closed 8 years ago

alain-andre commented 8 years ago

I'm having a route model

class Route < ActiveRecord::Base
  has_many :etapes
  acts_as_mappable :through => :steps
end

and a step one (that contains lat and lgn)

class Step ActiveRecord::Base
  belongs_to :route
  acts_as_mappable
end

Actually, I can get the routes passing close to one point with the in_range scope : Route.joins(:steps).in_range(0..15, :origin => [lat, lng]).group(:id)

I'm trying to get the route passing close to 2 steps, acts_as_mappable does not have the scope I need, so I'm wondering what the best way to go ?

alain-andre commented 8 years ago

I understand this is not a geokit-rails issue. I close it while I answer in this SO