Array/Hash fields should fail somehow when assigned the wrong type.

XMLWordPrintableJSON

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

      Using Mongoid 3.0.6.

      class Cow
      include Mongoid::Document

      field :hash, :type => Hash
      field :array, :type => Array
      end

      Cow.create(:hash => ['a', 'b'], :array => {:i => 2})
      => #<Cow _id: 50711b98f4d5d4ee0e000002, _type: nil, hash: ["a", "b"], array: {:i=>2}>

      This is sort of worrisome. Is there a way to prevent this?

              Assignee:
              Durran Jordan
              Reporter:
              pschuegr
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: