Backbone-relational
Backbone-relational copied to clipboard
Backbone.Collection.add doesn't respect the { merge : true, at: <index> } option.
I want to merge and move a model to a particular index. When I pass the option { merge : true, at: 0 } it does merge but not moving the model to the given index.
Hi @Sundarasan - can you provide a test case showing the expected (but broken) behavior?
I believe there is a bug in backbone-relational's Collection.set implementation. The merge parameter is being overridden to false, but I can't think of any reason why it should be. Because of this existing model updates get dropped.
add(..., {merge: true}) works as expected when I remove this.
Because at that point, updates should already have been merged into the model - through the _prepareModel->findOrCreate route. Do you maybe have an example where that doesn't happen? Removing the merge: false causes other tests to fail.
I'm not seeing the updates getting in, I'll see if I can pin things down better.