Where Store has act_as_mappable :through => :location
Unfortunately sort_by distance_from doesnt work with :through associations, but you can fix it with the following
In acts_as_mappable.rb in sort_by_distance_from function replace the following line:
I needed to have results include calculated distances, so per your docs I tried to use
bounds=Bounds.from_point_and_radius(home,5) stores=Store.find :all, :include=>[:reviews,:cities] :bounds=>bounds stores.sort_by_distance_from(home)
Where Store has act_as_mappable :through => :location
Unfortunately sort_by distance_from doesnt work with :through associations, but you can fix it with the following In acts_as_mappable.rb in sort_by_distance_from function replace the following line:
e.send("#{distance_attribute_name}=", e.distance_to(origin,opts))
with the following 2 lines:
responder = e.through.blank? ? e : e.send(e.through) e.send("#{distance_attribute_name}=", responder.distance_to(origin,opts))