Correctly test for an empty Tag array

issue #858

- fixes syntax errors in mysql
This commit is contained in:
Hannah Wolfe 2013-09-27 11:55:02 +01:00
parent 71711c1fd2
commit e6b779330f

View File

@ -128,7 +128,7 @@ Post = GhostBookshelf.Model.extend({
}
});
if (tagsToAttach) {
if (!_.isEmpty(tagsToAttach)) {
return Tags.forge().query('whereIn', 'name', _.pluck(tagsToAttach, 'name')).fetch().then(function (matchingTags) {
_.each(matchingTags.toJSON(), function (matchingTag) {
tagOperations.push(self.tags().attach(matchingTag.id));