Created
September 16, 2010 20:33
-
-
Save sdepold/583112 to your computer and use it in GitHub Desktop.
This file contains 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
var tags = tags_text.split(','); | |
var errors = []; | |
if (errors.length > 0) { | |
} else { | |
var new_question = new db.Question({ | |
title: title, | |
body: body, | |
doNotify: doNotify, | |
doNotifyEmail: doNotifyEmail | |
}); | |
var savings = [], | |
tagObjects = [] | |
savings.push({save: new_question}) | |
tags.forEach(function(_tag) { | |
var tag = new db.Tag({ tag: tag.trim() }) | |
tagObjects.push(tag) | |
}) | |
tagObjects.forEach(function(tag) { | |
savings.push({save: tag}) | |
}) | |
Sequelize.chainQueries(savings, function() { | |
new_question.setTags(tagObjects) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment