Skip to content

Instantly share code, notes, and snippets.

@mkocher
Created April 5, 2012 17:24
Show Gist options
  • Save mkocher/2312675 to your computer and use it in GitHub Desktop.
Save mkocher/2312675 to your computer and use it in GitHub Desktop.
Species = DS.Model.extend({
name: DS.attr('string')
});
Person = DS.Model.extend({
name: DS.attr('string'),
species: DS.belongsTo(Species, { embedded: true })
tags: DS.hasMany(Tag, { embedded: true })
});
person = store.load(Person,1,{id:1, species:{id:1, name:"Human"}});
machine = store.load(Species,2,{id:2, name:"Machine"});
// person.getPath('species.name') === "Human"
person.set('species', machine);
// person.getPath('species.name') === undefined
// should === "Machine"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment