Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
Fix accessing model attributes directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
hippich committed Feb 5, 2015
1 parent 776714b commit 9ae29b7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
9 changes: 7 additions & 2 deletions backbone.dualstorage.amd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion backbone.dualstorage.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ localsync = (method, model, options) ->
store.clean(model, 'dirty')
else
store.clean(model, 'destroyed')
response = response.attributes if response?.attributes

if response
if response.toJSON
response = response.toJSON(options)
if response.attributes
response = response.attributes

unless options.ignoreCallbacks
if response
Expand Down
9 changes: 7 additions & 2 deletions backbone.dualstorage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions spec/backbone.dualstorage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/localsync_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe 'localsync', ->
localsync 'create', model, {success: ((resp) -> response = resp)}
waitsFor (-> response), "A callback should have been called with a response", 100
runs ->
expect(response).toBe model.attributes
expect(response).toEqual model.attributes

it 'ignores callbacks when the ignoreCallbacks option is set', ->
{start, callback} = {start: new Date().getTime()}
Expand Down
2 changes: 1 addition & 1 deletion spec/localsync_spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ae29b7

Please sign in to comment.