nilbus/Backbone.dualStorage — pull request #51 by ilkerde (2013-09-25 13:32:13+00:00)
Title: Fix failing test for model update with custom id attribute.

This commit fixes a failing test for model updates with a custom id
attribute. It changes the strategy how updated fields from server-side
are merged with locally synced models. Instead of merging objects with
`_.extend()`, the received response is merged through `set()` method.

Background
----------
As far as I can judge (I'm very new to the codebase), this issue might
have been introduced with [PR36][1], which introduced merging model after
update. Changing the type of the second argument to `localsync` from
_bb.Model_ to _object_ seemed to cause the unwanted side effect that the
custom id attribute is no longer discoverable from within `localsync`.

Hence, the fixing strategy has been developed around the idea to adhere
to `localsync` type signature. The easiest solution seems to just
overwrite the existing local model instance with the received response
from server through `model.set()`, after previously having parsed the
response through `model.parse()` (just to be compatible to the overall
idea of being agnostic from response formats).

Motivation
----------
I developed this fix in order to get the test suite to all green back
again. I stumbled over the failing test after I checked out the code for
investigation (in pursuit of a completely unrelated thing).

Notes
-----
This is my first contribution to the codebase. Please review my change
thoroughly. I ran the test suite against Chromium and Firefox browsers.
Thanks for your efforts on backbone.dualStorage!

[1]: https://github.com/nilbus/Backbone.dualStorage/pull/36