Ember.js 如何使用成员数据装置创建多态1:1关系?
页面与名为PageContent的模型具有多态性1:1关系。PageContent有两个子类型TextOnly和Video。我想能够做一个findAll的页面,并得到所有的内容回来。我做错了什么 这似乎有效: 我能看到的唯一错误是App.Page.FIXTURES 应该是:Ember.js 如何使用成员数据装置创建多态1:1关系?,ember.js,ember-data,polymorphic-associations,Ember.js,Ember Data,Polymorphic Associations,页面与名为PageContent的模型具有多态性1:1关系。PageContent有两个子类型TextOnly和Video。我想能够做一个findAll的页面,并得到所有的内容回来。我做错了什么 这似乎有效: 我能看到的唯一错误是App.Page.FIXTURES 应该是: App.Page.FIXTURES = [ { id: 1, title: "Introduction", pageContent: 1, pageContentType: "textO
App.Page.FIXTURES = [
{
id: 1,
title: "Introduction",
pageContent: 1,
pageContentType: "textOnly"
},{
id: 2,
title: "Summary",
pageContent: 1,
pageContentType: "Video"
}
];
或
App.Page.FIXTURES = [
{
id: 1,
title: "Introduction",
pageContent: {
id: 1,
type: "textOnly"
}
},{
id: 2,
title: "Summary",
pageContent: {
id: 1,
type: "Video"
}
}
];