Merge pull request #35 from strongloop/redefine-model
Redefine the existing class if it's resolved
This commit is contained in:
commit
e529322688
|
@ -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)) {
|
||||||
|
|
Loading…
Reference in New Issue