我尝试在我的风帆模型中定义自定义属性,并且我想访问相关表格中的某个字段,如何在风帆中执行此操作?请查看下面的示例代码
示例:
// models/User.js
attributes: {
name: 'string',
...
// now define the realtionship
school: { model: 'School' },
// define custom attribute
studyIn: function(){
// returns nothing
return this.school.name ;
}
}
// models/School.js
attributes: {
name: 'string',
address: 'string',
students: { collection: 'User', via: 'school' }
}
由于