Skip to content

Instantly share code, notes, and snippets.

@alexharris
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save alexharris/b89da1844fa5b24a872c to your computer and use it in GitHub Desktop.

Select an option

Save alexharris/b89da1844fa5b24a872c to your computer and use it in GitHub Desktop.
publications.js
Meteor.publish('links', function() {
var links = Links.find();
var tagTitles = links.map(function(p) { return p.tagTitle });
return [
links,
Tags.find({_id: {$in: tagTitles}})
];
});
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
notFoundTemplate: 'notFound',
waitOn: function() {
return [Meteor.subscribe('links')];
}
});
Router.route('/', {name: 'linksList'});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment