I setup an app that runs fine with the Fixture Adapter on.
This is a template that I'm using to render:
<div class="large-7 columns" id="song-list">
<div class="playlist-meta row">
<div class="large-12 columns">
<h4 class="subheader">Playlist</h4>
<h1 class="playlist-title">{{controller.name}}</h1>
</div>
</div>
{{#view App.SortableView}}
{{#each song in controller.songs}}
<li class="row song">
<button {{action "playSong" song}} class="toggle-play"><span class="entypo play"></span></button>
<h4 class="subheader song-artist"><a href="#">{{song.artist}}</a></h3>
<h3 class="song-title"><a href="#">{{song.name}}</a></h3>
</li>
{{/each}}
{{/view}}
</div>
When I use the REST Adapter, however, the songs do not render. The playlist name itself still renders, but not the songs.
This is what is being returned to me in terms of JSON:
{"playlist":{"id":1,"name":"playlist","songs":[{"id":1,"name":"Song Name","artist":"Song Artist","soundcloud":"/tracks/1"}]}}
Model as defined when I was using Fixture data:
App.Playlist = DS.Model.extend({
name: DS.attr('string'),
songs: DS.hasMany('App.Song'),
});
App.Song = DS.Model.extend({
name: DS.attr('string'),
artist: DS.attr('string'),
soundcloud: DS.attr('string'),
playlist: DS.hasMany('App.Playlist'),
});
App.Playlist.FIXTURES = [
{
id: 1,
name: 'Playlist Name',
songs: [1, 2, 3],
}];
App.Song.FIXTURES = [
{
id: 1,
name: 'Song Name',
artist: 'Song Artist',
soundcloud: '/tracks/12345',
}];
{{#each song in playlist.songs}}
? Your sample of parsed JSON is an object with keyplaylist
, which in turn has the keysongs
. However,{{controller.name}}
wouldn't work either I suppose, it would have to be{{playlist.name}}
. – Christoffer