sutty/app/models/metadata_geo.rb

21 lines
331 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?
2020-06-09 18:49:14 +00:00
value == default_value
2020-02-16 22:51:43 +00:00
end
def save
return true if empty?
2020-06-09 18:49:14 +00:00
self[:value] = value.transform_values(&:to_f)
true
2020-02-16 22:51:43 +00:00
end
end