5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 01:06:21 +00:00
panel/app/models/metadata_geo.rb
2020-02-16 19:51:43 -03:00

23 lines
402 B
Ruby

# 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