Merge pull request #60 from strongloop/feature/improve-remoting-metadata

Fill ModelClass.http.path
This commit is contained in:
Miroslav Bajtoš 2014-01-22 09:06:19 -08:00
commit 411bb6e311
1 changed files with 4 additions and 2 deletions

View File

@ -109,7 +109,8 @@ ModelBuilder.prototype.getModelDefinition = function(name) {
ModelBuilder.prototype.define = function defineClass(className, properties, settings, parent) {
var modelBuilder = this;
var args = slice.call(arguments);
var pluralName = settings && settings.plural;
var pluralName = (settings && settings.plural) ||
inflection.pluralize(className);
if (!className) {
throw new Error('Class name required');
@ -186,8 +187,9 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
// Add metadata to the ModelClass
hiddenProperty(ModelClass, 'modelBuilder', modelBuilder);
hiddenProperty(ModelClass, 'dataSource', modelBuilder); // Keep for back-compatibility
hiddenProperty(ModelClass, 'pluralModelName', pluralName || inflection.pluralize(className));
hiddenProperty(ModelClass, 'pluralModelName', pluralName);
hiddenProperty(ModelClass, 'relations', {});
hiddenProperty(ModelClass, 'http', { path: '/' + pluralName });
// inherit ModelBaseClass static methods
for (var i in ModelBaseClass) {