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

Interger casting ignores trailing characters

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

      I use mongoid 2.4.7 right now and have following definition:

      field :n, type: Integer, :as => :issue

      When I now create an Object that sets n: 20ssss it is saved as String

      a = Foo.where(n: "20ssss").first
      => #<Foo _id: 4f83969534442ed981000005, _type: nil, p: "words words", s: "more words", n: "20ssss", v: 1, h: "b12c565e99c37285e0fe7c8b49b71df23b82ec73">

      > a.n.inspect
      => "\"20ssss\""

      This was already mentioned in this thread:
      http://groups.google.com/group/mongoid/browse_thread/thread/fa2adeaa0a21dd6b

      Unfortunately I could not find a relating Issue here on GitHub and I am running into the same problem even it was mentioned there two months ago.

      Am I missing a setting or why does this do something (in my perception) unintended?

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

              Created:
              Updated:
              Resolved: