Skip to content

Instantly share code, notes, and snippets.

@misutowolf
Created August 25, 2014 13:03
Show Gist options
  • Select an option

  • Save misutowolf/95bc8fb038bb1909da6d to your computer and use it in GitHub Desktop.

Select an option

Save misutowolf/95bc8fb038bb1909da6d to your computer and use it in GitHub Desktop.
this.route('profile', {
path: '/profile/:username',
waitOn: function() {
return this.subscribe("userByUsername", this.params.username);
},
data: function() {
var userDoc = Meteor.users.findOne({"username": this.params.username});
// Guard against non-ready user document.
if (!userDoc) {
return;
}
// Otherwise...
var bookCursor = Books.find({owner: userDoc._id});
return {
theUser: userDoc,
theBooks: bookCursor
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment