backbone-nested
backbone-nested copied to clipboard
Set() with complex JSON overwrites rather than updating nested attributes
Backbone fetch() uses JSON to set the attributes once they are received, which is causing nested attributes to be overwritten rather than being updated.
I am not sure if this is by design, or a bug, but I was expecting the same behavior whether setting the values using '.' or by directly using a complex JSON. E.g. model.set('name.firstName','John') ----> only updates firstName of nested name attribute model.set({name:{firstName:'John'}}); ----> replaces the nested name attribute
JsFiddle: http://jsfiddle.net/c2yjzs2u/1/