PaulUithol/Backbone-relational — Issue #38: Does automatic nested model creation update existing nested models?
Author: aliasone
Created: 2011-10-08 04:17:22+00:00
State: open

I'm deflating models sending them over websockets and inflating them on the other side. The automatic model creation is GREAT for this.

My question is about how it works exactly though. When I set unchanged data these models still throw all sorts of events.

if model = //some backbone model instance

model = model.set(model.toJSON) shouldn't throw any events normally since nothing has changed.

I was hoping nested model creation would work the same way but it seems that if you set attributes on the parent model it creates all new nested models and clobbers the old ones.

Let me know if there is a way to do this, or if I just completely don't understand something. It would be really really useful if model creation was smart enough to update existing nested models.

Thanks for the great work!