と の 2 つのモデルがRecipe
ありUser
ます。レシピでユーザー オブジェクトを取得できません。私は何を間違っていますか?
App.Recipe.find(1).get('title') // Returns "recipe01 title". All works fine.
App.Recipe.find(1).get('user') // Returns null
user.js.coffee
App.User = DS.Model.extend
email: DS.attr('string')
recipes: DS.hasMany('App.Recipe')
レシピ.js.コーヒー
App.Recipe = DS.Model.extend
user: DS.belongsTo('App.User')
title: DS.attr('string')
私のjson配列
{
recipe: {
id: 1,
title: "recipe01",
user: {
id: 1,
name: "ejiqpep",
email: "ejiqpep@gmail.com",
}
}
}