I have a simple model with no explicit validations:

class WeatherStation
  include DataMapper::Resource

  property :id, Serial
  property :callsign, String
  property :lat, Decimal, :precision => 9, :scale => 6
  property :lng, Decimal, :precision => 9, :scale => 6
end


And a simple test:

>> lat = 41.52639
>> lng1 = -71.150299
>> lng2 = -71.18972


Creating a record with lng1 succeeds:

>> a = WeatherStation.create(:callsign => "a", :lat => lat, :lng => lng1)
=> #<WeatherStation @id=8 @callsign="a" 
@lat=#<BigDecimal:1039e9338,'0.4152639E2',18(45)> 
@lng=#<BigDecimal:1039e8c08,'-0.71150299E2',18(45)>>


Creating a record with lng2 fails (as evidenced by @id=nil):

>> b = WeatherStation.create(:callsign => "b", :lat => lat, :lng => lng2)
=> #<WeatherStation @id=nil @callsign="b" 
@lat=#<BigDecimal:103a15230,'0.4152639E2',18(45)> 
@lng=#<BigDecimal:103a148d0,'-0.7118971999 999999E2',27(45)>>
>> b.errors.full_messages 
=> ["Lng must be a number"]


My best guess is that attempting to coerce "-71.150299" into a Decimal is 
working but coercing "-71.18972" is failing.  Can anyone offer insights as 
to what is going on and how to fix this?


-- 
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