Merge pull request #160 from strongloop/feature/fix-upsert-remoting

Make sure 'upsert' is used as the remote operation name
This commit is contained in:
Raymond Feng 2014-07-02 22:55:47 -07:00
commit 21b467e649
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;
}