mongoid/mongoid — Issue #1554: Possible regression from 2.3.4 regarding initialization of Hash fields
Author: behrangsa
Created: 2012-01-05 10:51:16+00:00
State: open

Given this document:

```ruby
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 `{}`:

```ruby
a = Article.new
a.foo = "foo"
```

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