-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
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 [#<Task _id: 4ed5e87d662e0c6f76000002, title: "Task title", project_id: BSON::ObjectId('4ed5e83b662e0c6f76000001')>]
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