Skip to content

Instantly share code, notes, and snippets.

@topherfangio
Created July 19, 2011 07:38
Show Gist options
  • Save topherfangio/1091598 to your computer and use it in GitHub Desktop.
Save topherfangio/1091598 to your computer and use it in GitHub Desktop.
Example of a computed property using @each
MyApp.Project = SC.Record.create({
tasks: SC.Record.toMany(...),
tasksNeedUpdate: 0,
tasksDidUpdate: function() {
this.set('tasksNeedUpate', this.get('tasksNeedUpdate') + 1);
}.observes('*[email protected]'),
allTasksCompleted: function() {
return this.get('tasks').everyProperty('isComplete', true);
}.property('tasksNeedUpdate')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment