Skip to content

Instantly share code, notes, and snippets.

@publickeating
Created May 29, 2013 17:31
Show Gist options
  • Save publickeating/5672130 to your computer and use it in GitHub Desktop.
Save publickeating/5672130 to your computer and use it in GitHub Desktop.
MyApp.Group = SC.Record.extend({
name: SC.Record.attr(String),
people: function () {
var query,
ret;
query = SC.Query.local(MyApp.Person, {
conditions: 'group = {self}',
parameters: { self: this }
});
ret = this.get('store').find(query);
return ret;
}.property().cacheable()
});
MyApp.Person = SC.Record.extend({
name: SC.Record.attr(String),
group: SC.Record.toOne('MyApp.Group')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment