Skip to content

Instantly share code, notes, and snippets.

@arush
Forked from spacenick/gist:5397435
Created April 16, 2013 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arush/5397620 to your computer and use it in GitHub Desktop.
Save arush/5397620 to your computer and use it in GitHub Desktop.
// You can do that in your Chrome Console
// Load the initial object, like an Attempt
var attempt = new Parse.Object("Attempt");
attempt.id = "myId";
attempt.fetch();
// Get the relation "handler" from the attempt object
var relation = attempt.relation("products");
// Add some products to the relation. They don't need to be fetched, just to have an "id" property
var product = new Parse.Object("Products");
product.id = "id1";
relation.add(product);
// Let's add others product, we can use the same object as only the id matters
product.id = "id2";
relation.add(product);
// let's save the object to reflect the changes in Parse
attempt.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment