geokit / geokit-rails

Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.
MIT License
1.57k stars 245 forks source link

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

Closed vishalvijay closed 3 years ago

vishalvijay commented 9 years ago

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.

rafaeljcadena commented 6 years ago

Same here. Any ideas?

ryankopf commented 3 years ago

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.