【发布时间】:2014-10-09 06:55:19
【问题描述】:
我正在尝试根据是否存在其他模型来编写条件模型架构。
例如,如果存在模型“消息”,则添加收件箱/发件箱:
var userSchema = {
attributes: {
...
}
}
var messageSchema = {
attributes: {
inbox: {
collection: 'Message'
},
outbox: {
collection: 'Message'
}
}
};
if (<function to check that Message Model is available)
_.merge userSchema, messageSchema
有可能做这样的事情吗?
【问题讨论】: