mongoid/mongoid — Issue #1462: accepts_nested_attributes_for saves upon assignment to _attributes
Author: wulffeld
Created: 2011-11-30 09:14:26+00:00
State: open

Given

```
class Project
include Mongoid::Document

field :title

references_many :tasks, :dependent => :destroy, :autosave => false

accepts_nested_attributes_for :tasks, :allow_destroy => true
end
```

and

```
class Task
include Mongoid::Document

field :title

referenced_in :project
end
```

Then in a console doing:

```
>> project = Project.create!
>> project.tasks_attributes = [{:title => "Task title"}]
>> p Project.first.tasks
[#]
```

Surely it shouldn't save until I actually call save, right? At least that's the AR way so this is leaving me to think this is a bug.

ruby 1.8.7p352 - mongoid 2.3.4 - rails 3.1.1