mongoid/mongoid — Issue #1438: Parents don't automatically accept nested attribs for embedded docs
Author: nickhoffman
Created: 2011-11-18 18:52:38+00:00
State: open

[The docs](http://mongoid.org/docs/relations/nested_attributes.html) say that nested attribute updating is enabled automatically for embedded docs. However, that doesn't seem to be the case in 2.3.3 :

```ruby
class Parent
include Mongoid::Document

embeds_many :children
end

class Child
include Mongoid::Document

field :name, :type => String

embedded_in :parent
end

Parent.new.children_attributes = []
NoMethodError: undefined method `children_attributes=' for #
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activemodel-3.1.0/lib/active_model/attribute_methods.rb:385:in `method_missing'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/mongoid-2.3.3/lib/mongoid/attributes.rb:184:in `method_missing'
from (irb):14
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.1.0/lib/rails/commands.rb:40:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'
```