5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 02:21:42 +00:00
panel/app/models/metadata_geo.rb

24 lines
402 B
Ruby
Raw Normal View History

2020-02-16 22:51:43 +00:00
# frozen_string_literal: true
# Define un campo de coordenadas geográficas
class MetadataGeo < MetadataTemplate
def default_value
{ 'lat' => nil, 'lng' => nil }
end
def empty?
value == default_value
end
def to_param
{ name => %i[lat lng] }
end
def save
self[:value] = {
'lat' => self[:value]['lat'].to_f,
'lng' => self[:value]['lng'].to_f
}
end
end