我有一个这样的嵌套模型:
var School = DS.Model.extend({
classrooms: DS.hasMany('classroom', {async: true})
});
var Classroom = DS.Model.extend({
students: DS.hasMany('student', {async: true}),
school: DS.belongsTo('school', {async: true})
});
var Student = DS.Model.extend({
name: DS.attr('string'),
classroom: DS.belongsTo('classroom', {async: true})
});
我使用 firebase 作为后端,并且我知道为了提高效率,建议对模式进行非规范化。明确指定关系是否有任何效用
var Student = DS.Model.extend({
school: DS.belongsTo('school', {async: true});
});
对于Student
模型,即使每个Student
属于 aClassroom
和每个Classroom
属于 a都暗示了这一点School
?