0

9.7.1) を ember データ (最新のマスター) で使用すると、奇妙な問題が発生します。私は埋め込まれた関係を持っています:

App.Person = DS.Model.extend({
  ...
  portions: DS.hasMany("App.PersonPortion", { embedded: true}),
  ...
  portionCount: function() {
    return this.get('person_portions').get('length')
  }.property("person_portions.@each")  //This line is the problem.  If I remove "person_portions.@each" it will load correctly
})

person の JSON は次のようになります。

{"age":null,
 "created_at":"2012-03-24T09:15:31Z",
 "diet_id":5,
 "id":1,
 "lactating":false,
 "name":"cool Name new",
 "pregnant":false,
 "sex":"F","updated_at":"2012-03-27T15:44:03Z",
 "portions":[{"created_at":"2012-04-12T14:54:49Z","crop_id":1,"id":13,"person_id":1,"portion":50,"unit":"grams","updated_at":"2012-04-25T00:41:36Z"},{"created_at":"2012-04-25T00:57:43Z","crop_id":16,"id":20,"person_id":1,"portion":null,"unit":null,"updated_at":"2012-04-26T12:13:48Z"},{"created_at":"2012-04-26T12:13:27Z","crop_id":6,"id":62,"person_id":1,"portion":null,"unit":null,"updated_at":"2012-04-26T12:16:38Z"}]}

しかし、個人App.store.find(App.Person, 1)をロードすると、Ember はサーバーから「部分」関係をロードしようとします。これは Chrome コンソールからのものです。

GET http://localhost:3000/person_portions?ids%5B0%5D%5Bcreated_at%5D=2012-04-12T14%3A54%3A49Z&ids%5B0%5D%5Bcrop_id%5D=1&ids%5B0%5D%5Bid%5D=13&ids%5B0%5D%5Bperson_id%5D=1&ids%5B0%5D%5Bportion%5D=50&ids%5B0%5D%5Bunit%5D=grams&ids%5B0%5D%5Bupdated_at%5D=2012-04-25T00%3A41%3A36Z

私が間違っているかもしれないことについてのアイデアはありますか、それともバグですか?

4

0 に答える 0