Skip to content

Instantly share code, notes, and snippets.

@Neppord
Last active December 12, 2015 03:18
Show Gist options
  • Save Neppord/4705507 to your computer and use it in GitHub Desktop.
Save Neppord/4705507 to your computer and use it in GitHub Desktop.
Trying to understand DS.Model
window.Models = EM.Namespace.create();
DS.RESTAdapter.map('Models.model', {
primaryKey: 'idx'
})
Models.model = DS.Model.extend({
init: function () {
this.super();
Em.run.next({
this.set('idx', this.get('key1') + '|' + this.get('key2'));
});
},
idx: DS.attr('string'), // key1 + "|" + key2
key1: DS.attr('string'),
key2: DS.attr('string')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment