-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
I think it's a bit counterintuitive that you can do this:
Parent.create(:child => { :field => :value })
but you can't do the same when updating:
parent_object.update_attributes(:child => { :field => :value }) (method 1)
Instead, you have to declare it with accepts_nested_attributes_for :child and call
parent_object.update_attributes(:child_attributes => { :field => :value }) (method 2)
I've forked mongoid and added some changes to allow updating embedded documents through method (1). allow_nested_attributes_for doesn't seem to apply to MongoDB's embedded documents.
Here's the link: