I have this structure:
App.Router.map(function() {
this.resource('board', {path: '/board'}, function() {
this.route('new', {path: '/new'});
this.route('show', {path: '/show/:board_id'});
});
});
App.Board = DS.Model.extend({
title: DS.attr('string'),
initialAmount: DS.attr('number'),
initialDate: DS.attr('date'),
boardItems: DS.hasMany('BoardItem'),
_csrf: DS.attr()
});
App.BoardItem = DS.Model.extend({
title: DS.attr('string'),
income: DS.attr('number'),
outcome: DS.attr('number'),
date: DS.attr('date'),
itemType: DS.attr('string'),
board: DS.belongsTo('Board')
});
App.BoardShowRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('board', params.board_id).sort();
}
});
and in the view, I list the board items like that:
{{#each boardItems}}
what I'm trying to do is sorting the boardItems by date, and I can't find a way of doing it... any ideas?
Thanks!