Skip to content

Instantly share code, notes, and snippets.

@mde
Last active December 30, 2015 09:29
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 mde/7810003 to your computer and use it in GitHub Desktop.
Save mde/7810003 to your computer and use it in GitHub Desktop.
"foo" task for creating a new Foo instance
task('foo', {async: true}, function () {
var f = geddy.model.Foo.create({title: 'zerb', description: 'frang'});
f.save(function (err, data) {
if (err) { throw err; }
geddy.model.Foo.all({id: f.id}, function (err, data) {
if (err) { throw err; }
console.log('Found foo', data[0].id);
geddy.model.Foo.first({id: f.id}, function (err, data) {
if (err) { throw err; }
console.log('Found foo again', data.id);
complete();
});
});
});
});
// Output
// $ geddy jake foo environment=production
// Found foo DA8D226F-6211-4316-9D96-490C5738E1CD
// Found foo again DA8D226F-6211-4316-9D96-490C5738E1CD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment