mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-25 10:11:48 -04:00
22 lines
373 B
Ruby
22 lines
373 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
|