0
我定义了两种资源 - 富和酒吧 - 在富包含一个酒吧。然而,当以这种格式插入一些基本数据时,如果多个Foo参考相同的条,则只给最近加载的Foo参考它。上一页富的没有酒吧(这是不确定的。)资源不引用相同的相关资源
资源的定义,像这样:
DS.defineResource({
name: 'Foo',
relations: {
hasOne: {
Bar: {
foreignKey: 'fooId',
localField: 'bar'
}
}
}
});
DS.defineResource({
name: 'Bar',
relations: {
belongsTo: {
Foo: {
localField: "foo",
localKey: "fooId"
}
}
}
});
而且我注入了以下测试数据:
var foosJson = [
{
id: 1,
bar: {
id: 100
}
}, {
id: 2,
bar: {
id: 100
}
}, {
id: 3,
bar: {
id: 200
}
}
];
为什么第一个Foo没有引用与第二个Foo相同的Bar?
拨弄茉莉花测试在这里:http://jsfiddle.net/dimmreaper/c0o1kqd0/
谢谢!那么,有没有办法用给定的json例子来配置一个多对多的关系呢? –