Removed normalization (see strong-remoting)
This commit is contained in:
parent
ef65ffee48
commit
81a822524d
|
@ -53,10 +53,6 @@ function isModelClass(cls) {
|
||||||
return cls.prototype instanceof DefaultModelBaseClass;
|
return cls.prototype instanceof DefaultModelBaseClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelBuilder.normalizePathName = function(pathName, className) {
|
|
||||||
return inflection.transform(pathName, ['underscore', 'dasherize']);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a model by name.
|
* Get a model by name.
|
||||||
*
|
*
|
||||||
|
@ -116,11 +112,6 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
|
||||||
inflection.pluralize(className);
|
inflection.pluralize(className);
|
||||||
|
|
||||||
var pathName = (settings && settings.path) || pluralName;
|
var pathName = (settings && settings.path) || pluralName;
|
||||||
var normalize = settings && settings.normalize;
|
|
||||||
|
|
||||||
if (this.normalizePathName || (normalize && this.normalizePathName !== false)) {
|
|
||||||
pathName = ModelBuilder.normalizePathName(pathName, className);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!className) {
|
if (!className) {
|
||||||
throw new Error('Class name required');
|
throw new Error('Class name required');
|
||||||
|
|
|
@ -555,21 +555,6 @@ describe('DataSource define model', function () {
|
||||||
var User = ds.define('User', {name: String, bio: String}, { path: 'accounts' });
|
var User = ds.define('User', {name: String, bio: String}, { path: 'accounts' });
|
||||||
User.http.path.should.equal('/accounts');
|
User.http.path.should.equal('/accounts');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should normalize the remoting path - option', function () {
|
|
||||||
var ds = new DataSource('memory');
|
|
||||||
|
|
||||||
var User = ds.define('UserAccount', {name: String, bio: String}, { normalize: true });
|
|
||||||
User.http.path.should.equal('/user-accounts');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should normalize the remoting path - modelBuilder', function () {
|
|
||||||
var ds = new DataSource('memory');
|
|
||||||
ds.modelBuilder.normalizePathName = true;
|
|
||||||
|
|
||||||
var User = ds.define('UserAccount', {name: String, bio: String});
|
|
||||||
User.http.path.should.equal('/user-accounts');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue