Skip to content

Instantly share code, notes, and snippets.

@redwraith2
Created April 30, 2015 13:30
Show Gist options
  • Save redwraith2/1f0979e70928c3b2716b to your computer and use it in GitHub Desktop.
Save redwraith2/1f0979e70928c3b2716b to your computer and use it in GitHub Desktop.
//Exhibit 1: They're the same
Template.notifications.helpers({
notifications: function(){
return Notifications.find({userId: Meteor.userId(), read: false});
},
notificationCount: function(){
return Notifications.find({userId: Meteor.userId(), read: false}).count();
}
});
//Exhibit 2: One references the other.
Template.notifications.helpers({
notifications: function(){
return Notifications.find({userId: Meteor.userId(), read: false});
},
notificationCount: function(){
return this.notifications().count();
}
});
//Why do these behave differently?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment