Skip to content

Instantly share code, notes, and snippets.

@tsgautier
Created October 9, 2012 21:28
Show Gist options
  • Save tsgautier/3861580 to your computer and use it in GitHub Desktop.
Save tsgautier/3861580 to your computer and use it in GitHub Desktop.
# expose a list of players
Template.scores.players = ->
return Objects.find({type: 'player'}, sort: sortOrder()).fetch().slice(0,Session.get('page_size'))
# expose a user object
Template.profile.user = ->
return Objects.findOne({type: 'user'})
Objects = new Meteor.Collection("objects")
# publish objects of type player
Meteor.publish 'players', (page_size, current_page, sort) ->
Objects.find({type: 'player'}, sort: sort, skip: (current_page-1)*page_size, limit: page_size)
# publish objects of type user
Meteor.publish 'users', ->
Objects.find {type: 'user'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment