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

Storing false values in fields of Array and Hash types fails but not in an expected way

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.0.6, 7.1.0
    • Affects Version/s: 7.0.0, 6.2.1, 6.3.0, 6.4.0, 6.4.1, 7.0.1, 7.0.2, 6.4.2, 7.0.3, 6.4.4, 7.0.4, 7.0.5
    • Component/s: Attributes
    • None

      class Person
        include Mongoid::Document
        field :map, type: Hash
      end
      
      person = Person.new
      
      person.map = false
      

      Expected behavior:

      A Mongoid::Errors::InvalidValue error is raised.

      Actual behavior:
      A NoMethodError: undefined method `update_values' for false:FalseClass error is raised.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            gabriel.prado@coffeebeantech.com Gabriel Prado
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: