Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var Promise = require('bluebird');
Bookshelf.transaction(Promise.coroutine(function*(t) {
const library = yield Library.forge({name: 'Old Books'}).save(null, {transacting: t});
return yield
{ title: 'Canterbury Tales' },
{ title: 'Moby Dick' },
{ title: 'Hamlet' }
(info) => Book.forge(info).save({ 'shelf_id': library.get("id") }, {transacting: t})
.then((library) => console.log(library.related('books').pluck('title')))
.catch((err) => console.error(err));

This comment has been minimized.

Copy link

commented Aug 23, 2016

return yield OP

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.