From e40eb12a51fe13d150739d322348d0b9a8b2679c Mon Sep 17 00:00:00 2001 From: Gabor Javorszky Date: Sat, 22 Jun 2013 12:25:43 +0100 Subject: [PATCH] Fix forge returning null on empty fetch Closes #184. It got broken because of https://github.com/tgriesser/bookshelf/commit/a9c4a5409e6bd422df2500aefded41bf50e134d3 --- core/shared/models/user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/shared/models/user.js b/core/shared/models/user.js index c16ba2c14c..347f72e664 100644 --- a/core/shared/models/user.js +++ b/core/shared/models/user.js @@ -74,9 +74,9 @@ */ return this.forge().fetch().then(function (user) { - _.each(user.attributes, function (value, key, list) { + if (user) { fail = true; - }); + } if (fail) { return when.reject(new Error('A user is already registered. Only one user for now!')); @@ -167,4 +167,4 @@ Users: Users }; -}()); \ No newline at end of file +}());