From f7afade22902fc251a251eb7aaaecd27e4cb3ba2 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Wed, 2 Jul 2014 12:20:56 -0700 Subject: [PATCH] Make sure 'upsert' is used as the remote operation name See https://github.com/strongloop/loopback/issues/359 --- lib/dao.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/dao.js b/lib/dao.js index 131be88c..7e8194cb 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -222,7 +222,10 @@ function stillConnecting(dataSource, obj, args) { * @param {Object} data The model instance data * @param {Function} callback The callback function (optional). */ -DataAccessObject.upsert = DataAccessObject.updateOrCreate = function upsert(data, callback) { +// [FIXME] rfeng: This is a hack to set up 'upsert' first so that +// 'upsert' will be used as the name for strong-remoting to keep it backward +// compatible for angular SDK +DataAccessObject.updateOrCreate = DataAccessObject.upsert = function upsert(data, callback) { if (stillConnecting(this.getDataSource(), this, arguments)) { return; }