DjangoRESTアダプターでのember-dataの使用。setupControllerフックで受け取ったモデルの関係に基づいてコントローラーのコンテンツを設定するのに問題がある
私はブレークポイントを入れました、そしてそれらはこの順序で行きました:
- ArtistRoute.model
 - ArtistTrackRoute.model
 - ArtistRoute.setupController
 - ArtistTrackRoute.setupController
 
詳細/質問については、これらの関数のコメントを参照してください。
トラックの主なアーティストは、トラック->所属する->アルバム->所属する->アーティストです。
アーティスト:artist-> hasMany-> albums
アルバムアルバム->belongsTo->アーティストアルバム->hasMany->トラック
トラックトラック->belongsTo->アルバム
API出力を確認しましたが、リソースリンクは間違いなくそこにあります。
これが私のモデルです:
App.Album = DS.Model.extend({
    'title' : DS.attr('string'),
    'slug' : DS.attr('string'),
    'year' : DS.attr('number'),
    'type' : DS.attr('string'),
    'image' : DS.attr('string'),
    'genre' : DS.attr('string'),
    'tracks' : DS.hasMany('App.Track'),
    'artist' : DS.belongsTo('App.Artist')
});
App.Track = DS.Model.extend({
    'title' : DS.attr('string'),
    'slug' : DS.attr('string'),
    'artists_titles' : DS.attr('string'),
    'artists_ids' : DS.attr('string'),
    'artists_slugs' : DS.attr('string'),
    'year' : DS.attr('number'),
    'genre' : DS.attr('string'),
    'label' : DS.belongsTo('App.Label'),
    'album' : DS.belongsTo('App.Album'),
    'creator' : DS.attr('number'),
    'created' : DS.attr('date'),
    'modified' : DS.attr('date'),
});
App.Artist = DS.Model.extend({
    'title' : DS.attr('string'),
    'image' : DS.attr('string'),
    'slug' : DS.attr('string'),
    'genre' : DS.attr('string'),
    'creator' : DS.attr('number'),
    'created' : DS.attr('date'),
    'modified' : DS.attr('date'),
    'absoluteUrl' : DS.attr('string'),
    'resourceUri' : DS.attr('string'),
    'albums' : DS.hasMany('App.Album'),
    'getImageURL' : function() {
        return (this.get('image')) ? '/static/img/' + this.get('image') + '.jpg' : false;
    }.property('image')
});
これが私のルートです:
App.ArtistRoute = Ember.Route.extend({
    'model' : function(params) {
        // here first
        return App.Artist.find(params.artist_id);
    },
    'serialize' : function(model) {
        "use strict";
        return {
            'artist_id' : model.get('id'),
            'artist_slug' : model.get('slug')
        };
    },
    'setupController' : function(controller, artist) {
        // here third...
        // I inspected artist._data
        // artist._data.hasMany.albums = [1]
        this.controllerFor('artist').set('content', artist);
    }
});
App.ArtistTrackRoute = Ember.Route.extend({
   'model' : function(params) {
        // here second
       return App.Track.find(params.track_id);
   },
   'serialize' : function(model) {
       "use strict";
       return {
           'track_id' : model.get('id'),
           'track_slug' : model.get('slug')
       }
   },
   'setupController' : function(controller, track) {
        // here fourth... I inspected the track data object
        // track._data.belongsTo.album == undefined
        // what I'm trying to achieve here is to set the album
        // controller based on the belongsTo relationship
        // this.controllerFor('album').set('content', track.get('album'))
       this.controllerFor('track').set('content', track);
   }
});
さらに、ArtistAlbumRoute.setupControllerでブレークポイントを設定すると、album._data.hasMany.tracks == [1]しかし、album._data.belongsTo.artist == undefined .... wtf?!?!?!
私はまだEmberに頭を巻くのに苦労しているので、追加のアドバイスをいただければ幸いです。ありがとう!
さらに、ページが読み込まれてコンソールを開いた後、何が設定されているかを確認するためにコントローラーにアクセスするには何を入力しますか?