Refreshing model on multiple requests same url


I want to use a remote service that exposes an api for returning a random item, something like this:

However, from within Ember I cannot get the model to refresh and make an additional request to pick up the newer results.

I’ve tried various things, including:


but this doesn’t seem to work either.

Is there an easier more elegant manner to achieve this that I am overlooking?


Does reload not do the job?


Sure, if I hit F5 (refresh browser) it works fine.

Only using the button with action doesn’t :frowning:


I mean the reload method :wink:


Yes, as I said in the original message (I meant model.reload() sorry). Here’s a code sample:

actions: {
  random: function() {
    var model = this.get('model');
    if (model) {
      var _this = this;


:wink: Not sure but this.controller.get('model').reload() seems better. You need to reload the data on the controller.


That’s not going to work because the action is being handled from within the controller already and NOT within the route, any other ideas?


Not much ideas. Do you use setupController on the route? I remember reading this and perhaps your model is also not fetched.


To me requesting a random item seems to fit better with store.query as opposed to refreshing a model.