Skip to content

Instantly share code, notes, and snippets.

@zoghal
Forked from mkocher/gist:2312675
Created June 11, 2012 07:40
Show Gist options
  • Save zoghal/2908930 to your computer and use it in GitHub Desktop.
Save zoghal/2908930 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