I play with a sample Ember application, which displays all the data stored in the Fixture, and finally tries to show random data from the device.
Full demo here: http://jsbin.com/ifatot/2/edit
Everything works fine, however I cannot get a random index from Ember data. I try to find its length and capture a random index, but I believe that the length is always 0, although I have data.
The function is as follows:
App.ThoughtsController = Ember.ArrayController.extend({ randomMessage: function() { var thoughts = this.get('model'); var len = thoughts.get('length'); var randomThought = (Math.floor(Math.random()*len)); return thoughts.objectAt(randomThought); }.property('model') });
source share