Changed options.path to options.http.path

This commit is contained in:
Fabien Franzen 2014-08-05 09:10:43 +02:00
parent 66fe60e6ca
commit 18c647a9bb
2 changed files with 7 additions and 5 deletions

View File

@ -345,7 +345,7 @@ Model.remoteMethod = function(name, options) {
Model.belongsToRemoting = function(relationName, relation, define) { Model.belongsToRemoting = function(relationName, relation, define) {
var fn = this.prototype[relationName]; var fn = this.prototype[relationName];
var pathName = relation.options.path || relationName; var pathName = (relation.options.http && relation.options.http.path) || relationName;
define('__get__' + relationName, { define('__get__' + relationName, {
isStatic: false, isStatic: false,
http: {verb: 'get', path: '/' + pathName}, http: {verb: 'get', path: '/' + pathName},
@ -357,7 +357,7 @@ Model.belongsToRemoting = function(relationName, relation, define) {
Model.hasOneRemoting = function(relationName, relation, define) { Model.hasOneRemoting = function(relationName, relation, define) {
var fn = this.prototype[relationName]; var fn = this.prototype[relationName];
var pathName = relation.options.path || relationName; var pathName = (relation.options.http && relation.options.http.path) || relationName;
define('__get__' + relationName, { define('__get__' + relationName, {
isStatic: false, isStatic: false,
http: {verb: 'get', path: '/' + pathName}, http: {verb: 'get', path: '/' + pathName},
@ -368,7 +368,7 @@ Model.hasOneRemoting = function(relationName, relation, define) {
} }
Model.hasManyRemoting = function (relationName, relation, define) { Model.hasManyRemoting = function (relationName, relation, define) {
var pathName = relation.options.path || relationName; var pathName = (relation.options.http && relation.options.http.path) || relationName;
var toModelName = relation.modelTo.modelName; var toModelName = relation.modelTo.modelName;
var findByIdFunc = this.prototype['__findById__' + relationName]; var findByIdFunc = this.prototype['__findById__' + relationName];
@ -463,7 +463,7 @@ Model.hasManyRemoting = function (relationName, relation, define) {
}; };
Model.scopeRemoting = function(relationName, relation, define) { Model.scopeRemoting = function(relationName, relation, define) {
var pathName = relation.options.path || relationName; var pathName = (relation.options.http && relation.options.http.path) || relationName;
var toModelName = relation.modelTo.modelName; var toModelName = relation.modelTo.modelName;
define('__get__' + relationName, { define('__get__' + relationName, {

View File

@ -657,7 +657,9 @@ describe('relations - integration', function () {
); );
recipe.referencesMany(ingredient); recipe.referencesMany(ingredient);
// contrived example for test: // contrived example for test:
recipe.hasOne(photo, { as: 'picture', options: { path: 'image' } }); recipe.hasOne(photo, { as: 'picture', options: {
http: { path: 'image' }
} });
}); });
before(function createRecipe(done) { before(function createRecipe(done) {