Merge pull request #80 from strongloop/feature/remoting-belongsTo

Make the belongsTo relation remotable
This commit is contained in:
Raymond Feng 2014-03-04 08:57:57 -08:00
commit ab8076d44a
1 changed files with 9 additions and 0 deletions

View File

@ -277,6 +277,15 @@ Relation.belongsTo = function (anotherClass, params) {
}
};
// Set the remoting metadata so that it can be accessed as /api/<model>/<id>/<belongsToRelationName>
// For example, /api/orders/1/customer
var fn = this.prototype[methodName];
fn.shared = true;
fn.http = {verb: 'get', path: '/' + methodName};
fn.accepts = {arg: 'refresh', type: 'boolean', http: {source: 'query'}};
fn.description = 'Fetches belongsTo relation ' + methodName;
fn.returns = {arg: methodName, type: 'object', root: true};
};
/**