lib/mongoid/geo/fields.rb in mongoid_geo-0.5.2 vs lib/mongoid/geo/fields.rb in mongoid_geo-0.5.3
- old
+ new
@@ -16,12 +16,14 @@
define_method(lat_meth) { read_attribute(name).try(:[], Mongoid::Geo.lat_index) }
define_method(lng_meth) { read_attribute(name).try(:[], Mongoid::Geo.lng_index) }
define_method "#{lat_meth}=" do |value|
+ write_attribute(name, [nil,nil]) if !read_attribute(name).present?
send(name)[Mongoid::Geo.lat_index] = value
end
define_method "#{lng_meth}=" do |value|
+ write_attribute(name, [nil,nil]) if !read_attribute(name).present?
send(name)[Mongoid::Geo.lng_index] = value
end
end
define_method("#{meth}=") do |value|
\ No newline at end of file