Make sure 'upsert' is used as the remote operation name

See https://github.com/strongloop/loopback/issues/359
This commit is contained in:
Raymond Feng 2014-07-02 12:20:56 -07:00
parent 8a7e5806a3
commit f7afade229
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}