Acts_as_mappable :through relationship is not working

Hello-
I have two models (User and Locations). One user can have multiple
locations (home, office etc…) The location table has the lat and
lngs.

class User < ActiveRecord::Base
has_many :locations
acts_as_mappable :through => :locations

class Location < ActiveRecord::Base
belongs_to :user
acts_as_mappable

Now, when I do User.find_within(500. :origin => …), It fails with the
following error:
Mysql::Error: Unknown column ‘users.lat’ in ‘field
list’:

So, it seems that the :through relationship is not working. Can
someone pelase help me.

thanks
-John

John,

acts_as_mappable is not an association, it’s a custom macro and it
doesn’t support :through option.

So remove it from the User model. And to find all users near some
point use something like:

Location.find_within(500. :origin => …, :include => :user).map
(&:user).uniq

Dmitry