Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1272

[> 2.2.0] Cannot validate numericality, only_integer, with moderately large integers.

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.2.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      With mongoid (> 2.2.0), this spec fails. With mongoid (<= 2.2.0), the spec passes.

      The problematic line is lib/mongoid/fields/serializable/integer.rb#L24:

      ("%g" % object.to_s) =~ /\./ ? Float(object) : Integer(object)

      With ruby-1.9.2-p180, we have

      ("%g" % (1024**2).to_s)
      => "1.04858e+06"

            Assignee:
            Unassigned Unassigned
            Reporter:
            yfeldblum yfeldblum
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: