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

How to handle multiple lat, lng feilds in a single model ?

vishalvijay opened this issue · comments

Hi
Consider a model User with attributes last_lat, last_lng, current_lat and current_lng. How do I manage to add acts_as_mappable for both points.

Same here. Any ideas?

You currently cannot and this is not likely to be supported anytime soon.

You can achieve the same effect by creating a new model Location that belongs to the user. A user could then have both a current and a previous location object, and you would search by searching the Location objects which can be mappable.

If that's too much change for your code, you could create just a past location model that is only used for former locations.