I'm quite new to ember and trying to write a computed property that checks whether or not a user is online based on their 'state' property, defined in the user model, and then returns a count of the number of users online. This is what I have been attempting, which is not working-
onlineUsers: function() {
return this.get("model").filterBy("state", "online").get("model.length");
}.property("'model.[]'"),
And this is my user model-
App.User = DS.Model.extend({
name : DS.attr('string'),
email : DS.attr('string'),
state : DS.attr('string'),
subjects : DS.hasMany('subject')
});
Can anyone point out what I'm doing wrong?