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

XMLWordPrintableJSON

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

      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
            Reporter:
            yfeldblum
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: