Skip to content

Instantly share code, notes, and snippets.

@admc
Last active December 20, 2015 08:39
Show Gist options
  • Save admc/6101808 to your computer and use it in GitHub Desktop.
Save admc/6101808 to your computer and use it in GitHub Desktop.
this.create = function (req, resp, params) {
var self = this
, conversation = geddy.model.Conversation.create(params);
if (!conversation.isValid()) {
params.errors = conversation.errors;
self.transfer('add');
}
conversation.save(function(err, data) {
if (err) {
params.errors = err;
self.transfer('add');
} else {
data.addUser(self.user);
data.save(function(err, data) {
self.redirect({controller: self.name});
})
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment