Skip to content

Instantly share code, notes, and snippets.

@chovy chovy/controller.js
Created Jun 14, 2015

What would you like to do?
thinky hasAndBelongsToMany = function *(next){
var data = this.request.body;
var tagIds = => {
delete data.tags;
var post = new Post(data);
post.tags = tagIds;
var newPost = yield post.saveAll(); //save joins
var result = yield Post.get({ tags: true });
this.body = result;
yield next;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.