mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
15 lines
355 B
Ruby
15 lines
355 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Area < ApplicationRecord
|
|
reverse_geocoded_by :latitude, :longitude
|
|
|
|
belongs_to :user
|
|
has_many :visits, dependent: :destroy
|
|
|
|
validates :name, :latitude, :longitude, :radius, presence: true
|
|
|
|
alias_attribute :lon, :longitude
|
|
alias_attribute :lat, :latitude
|
|
|
|
def center = [latitude.to_f, longitude.to_f]
|
|
end
|