Possible regression from 2.3.4 regarding initialization of Hash fields

XMLWordPrintableJSON

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

      Given this document:

      class Article
        include Mongoid::Document
      
        field :details, type: Hash
      
        def foo=(f)
          self.details[:foo] = f
        end
      end
      

      In 2.3.4 the code snippet below works with no problem, as :details is initialized with {}:

      a = Article.new
      a.foo = "foo"
      

      However in 2.4.0 it no longer works, as self.details is nil after initialization.

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

              Created:
              Updated:
              Resolved: