Make the belongsTo relation remotable
This commit is contained in:
parent
97c5cfd644
commit
14745b1305
|
@ -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};
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue