Created
November 5, 2013 21:19
-
-
Save ahx/7326500 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapters/application.js | |
var ApplicationAdapter = DS.Adapter.extend({ | |
init: function() { | |
this.hoodie = window.hoodie; // FIXME? | |
this._super(); | |
}, | |
find: function(store, type, id) { | |
return this.hoodie.store.find(type.typeKey, id); | |
}, | |
findAll: function(store, type, since) { | |
return this.hoodie.store.findAll(type.typeKey); | |
}, | |
createRecord: function(store, type, record) { | |
return this.hoodie.store.add(type.typeKey, record.toJSON()); | |
}, | |
updateRecord: function(store, type, record) { | |
return this.hoodie.store.update(type.typeKey, record.get('id'), record.toJSON()); | |
}, | |
deleteRecord: function(store, type, record) { | |
return this.hoodie.store.remove(type.typeKey, record.get('id')); | |
} | |
}); | |
export default ApplicationAdapter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// serializers/application.js | |
var ApplicationSerializer = DS.JSONSerializer.extend({ | |
primaryKey: '_id' | |
}); | |
export default ApplicationSerializer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are we done yet?
TODO: How to use embedded records?