-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
The following code demonstrates how an atomic integer increment persists a float:
class TestCase include Mongoid::Document field :int_field, :type => Integer, :default => 0 def self.update_integer_field() _x = TestCase.create _x.inc(:int_field, 4) end end
Incorrectly persists and returns a float in the atomic integer increment:
1.9.3p194 :002 > TestCase.update_integer_field => 4 1.9.3p194 :003 > TestCase.last.int_field => 4.0 1.9.3p194 :006 > TestCase.last.int_field.class.name => "Float"