mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-02-05 07:01:03 -05:00
- active (default: true)
- location, latitude and longitude (because when you move house, you
don't take your garden with you)
- area and area units (square feet or metres)
23 lines
372 B
Ruby
23 lines
372 B
Ruby
module Geocodable
|
|
def self.included(base)
|
|
base.extend(self)
|
|
end
|
|
|
|
private
|
|
|
|
def geocode
|
|
unless self.location.blank?
|
|
self.latitude, self.longitude =
|
|
Geocoder.coordinates(location, params: {limit: 1})
|
|
end
|
|
end
|
|
|
|
def empty_unwanted_geocodes
|
|
if self.location.blank?
|
|
self.latitude = nil
|
|
self.longitude = nil
|
|
end
|
|
end
|
|
|
|
end
|