Skip to content

Instantly share code, notes, and snippets.

@gabrielhpugliese
Created February 12, 2013 18:47
Show Gist options
  • Save gabrielhpugliese/4772203 to your computer and use it in GitHub Desktop.
Save gabrielhpugliese/4772203 to your computer and use it in GitHub Desktop.
Subscription is not working like it was.
if (Meteor.isClient) {
Meteor.startup(function(){
Session.set('MediasLoading', true);
Meteor.autosubscribe(function(){
Meteor.subscribe('Medias', function(){
Session.set('MediasLoading', false);
});
});
});
}
Template.index.top10 = function(){
if (Session.get('MediasLoading'))
return;
var medias = Medias.find({}, {limit: 10, sort: {tempo: -1}}).fetch(),
maior_tempo = medias[0]['tempo']; // Uncaught TypeError: Cannot read property 'tempo' of undefined
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment