简体   繁体   中英

Confused on how to setup Geokit

So I've searched through all the documentation on Geokit for rails and didn't find any setup process for it except for installing the gem which I know how to do. what tables do I add to an existing "listings" table?

I've like I said, have it installed. And I've added the acts_as_mappable to the listings ruby file.

class Listing < ApplicationRecord
  acts_as_mappable
end
gem 'geokit-rails'

It would be nice if there was a video tutorial done on how to set this entire thing up.

You need to add a lat and lng field to your Listing model. You can do so like this:

rails g migration add_lat_lng_to_listings lat:decimal lng:decimal

Then migrate:

rails db:migrate

Once you have those fields, you should be able to do something like this:

Listing.in_range(1..35, origin: [29.794664, -98.731970])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM