Solved (sort of).  I dug around until I 
found https://github.com/datamapper/dm-validations/issues/51.  Here's what 
I did for a workaround:

class WeatherStation
  include DataMapper::Resource

  # property <name>, <type>
  property :id, Serial
  property :callsign, String
  property :lat, Decimal, :precision => 9, :scale => 6
  property :lng, Decimal, :precision => 9, :scale => 6

  def self.process_station(callsign, lat, lng)
    # workaround for https://github.com/datamapper/dm-validations/issues/51
    lat1 = BigDecimal(lat.to_f.round(6).to_s)
    lng1 = BigDecimal(lng.to_f.round(6).to_s)
    WeatherStation.first_or_create({:callsign => callsign}, 
                                   {:lat => lat1, :lng => lng1})
  end
end

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to