mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
18 lines
374 B
Ruby
18 lines
374 B
Ruby
|
|
# frozen_string_literal: true
|
||
|
|
|
||
|
|
class Place < ApplicationRecord
|
||
|
|
validates :name, :longitude, :latitude, presence: true
|
||
|
|
|
||
|
|
enum source: { manual: 0, google_places: 1 }
|
||
|
|
|
||
|
|
after_commit :async_reverse_geocode, on: :create
|
||
|
|
|
||
|
|
private
|
||
|
|
|
||
|
|
def async_reverse_geocode
|
||
|
|
return unless REVERSE_GEOCODING_ENABLED
|
||
|
|
|
||
|
|
ReverseGeocodingJob.perform_later(self.class.to_s, id)
|
||
|
|
end
|
||
|
|
end
|