Redefine the existing class if it's resolved

This commit is contained in:
Raymond Feng 2013-11-06 14:00:22 -08:00
parent 5d92bcb098
commit 34107a6a26
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 // Check if there is a unresolved model with the same name
var ModelClass = this.models[className]; 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 // every class can receive hash of data as optional param
ModelClass = function ModelConstructor(data, dataSource) { ModelClass = function ModelConstructor(data, dataSource) {
if(!(this instanceof ModelConstructor)) { if(!(this instanceof ModelConstructor)) {