Merge pull request #35 from strongloop/redefine-model

Redefine the existing class if it's resolved
This commit is contained in:
Raymond Feng 2013-11-06 14:39:41 -08:00
commit e529322688
1 changed files with 3 additions and 1 deletions

View File

@ -107,7 +107,9 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
// Check if there is a unresolved model with the same name
var ModelClass = this.models[className];
if(!ModelClass) {
// Create the ModelClass if it doesn't exist or it's resolved (override)
// TODO: [rfeng] We need to decide what names to use for built-in models such as User.
if(!ModelClass || !ModelClass.settings.unresolved) {
// every class can receive hash of data as optional param
ModelClass = function ModelConstructor(data, dataSource) {
if(!(this instanceof ModelConstructor)) {