geokit / geokit-rails

Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add a location to a object???

ChrisCPO opened this issue · comments

How do you add a location to an object? I have

class Location < ApplicationRecord
  belongs_to :locationable, polymorphic: true
  acts_as_mappable
end

the location class has the columns lng and lat. You would think this would work.

Location.new(orgin: "a zipcode" )

But that results in an error.(Origin is not an attribute). I'm I missing something. Can't find an answer in the docs.

I'm under the impression I can assign a location object that is acts_as_mappable given that object a physical location via this gem and then, do distance calculations between two objects. After reading though the docs this seems like this is an option, but the documentation for the is not well written. Where is a most basic use case? distance = Object.new(origin: [x,y]) - Object.new(origin: [x,y])?