Last active
December 30, 2015 09:29
-
-
Save mde/7810003 to your computer and use it in GitHub Desktop.
"foo" task for creating a new Foo instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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