Skip to content

Instantly share code, notes, and snippets.

@auggernaut
Created July 17, 2014 22:04
Show Gist options
  • Save auggernaut/2ac0f77f66a21e8b0a22 to your computer and use it in GitHub Desktop.
Save auggernaut/2ac0f77f66a21e8b0a22 to your computer and use it in GitHub Desktop.
update pref table in parse.
# UPDATE Pref table to include current user in peggedBy array
console.log "peggee: #{peggeeId} card: #{cardId} choice: #{choiceId} "
card = new Parse.Object 'Card'
card.set 'id', cardId
peggee = new Parse.Object 'User'
peggee.set 'id', peggeeId
prefQuery = new Parse.Query 'Pref'
prefQuery.equalTo 'card', card
prefQuery.equalTo 'user', peggee
prefQuery.first
success: (pref) =>
pref.addUnique 'peggedBy', UserStore.getUser().id
#pref.set 'peggedBy', null
pref.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment