Reputation: 2304
Using the geokit-rails gem, I have:
Employer.rb
model, with lng & lat attributes:
has_many :jobs, dependent: :destroy acts_as_mappable
Job.rb
model, with no lng or lat
acts_as_mappable :through => :employer
If I try Job.within(3, origin: [0, 0])
in the console, I get this error:
PG::UndefinedTable: ERROR: missing FROM-clause entry for table "employers"
LINE 2: ... (ACOS(least(1,COS(0.0)*COS(0.0)*COS(RADIANS(employers....
Upvotes: 1
Views: 200
Reputation: 43
I found a workaround:
Job.joins(:employer).within(3, origin: [0, 0])
Upvotes: 0