2014-02-16 61 views

回答

1

您需要更改post: ['2']post: '2'(因爲它是一個belongsTo關係,預計值不是一個數組):

App.Comment = DS.Model.extend({ 
    post: DS.belongsTo('post', { async: true }), 
    date_posted: DS.attr('date'), 
    author: DS.attr('string'), 
    message: DS.attr('string') 
}); 

App.Comment.FIXTURES = [{ 
    id: '1', 
    post: '2', 
    date_posted: new Date(), 
    author: 'Aaron', 
    message: 'Psyched for the third.' 
}]; 

http://jsbin.com/daqonone/1/