Store.find() calls api but I'm not getting any records


Hi all,

I’ve just started working with Ember but the following is giving me a headache since I cannot figure out why this doesn’t work.

So the problem is this:

My routes are defined like this:

this.resource('overview-products', { path: '/' });
this.resource('order', function() {
    this.route('configure-product', { path: '/configure/:id'});
    this.route('overview', { path: '/overview'});
    this.route('payment', { path: '/payment'});

And the flow is like this (short version):

  • On the overview-products page I select a product that I would like to order,
  • after that I go to the configure-product page
  • and when the product is configured, I go to the overview page

Now, my OrderOverviewRoute is like this (short version):

App.OrderOverviewRoute = Ember.Route.extend({
    model: function(params) {
        var order = this.modelFor('order');
        var items = [];
        var products ='product');

        // OTHER STUFF

The problem I’m now having is that products is always empty. Which shouldn’t be the case because I can see on my backend that an API call was made and that all products were returned.

Am I doing something wrong? Because I’m pretty much doing the exact same thing as I’m doing in my OverviewProductsRoute, where it does work.


What is the model property returning?


In my OrderOverviewRoute the model is returning the following:

return Ember.RSVP.hash({
    orderNumber: order.get('orderNumber'),
    items: items


Could it be the case that you use the products variable not as a promise but as the data itself? The find function returns a promise and not the data.

So, later in the code, the promise is not fulfilled yet, but you are already trying to consume the data (products)?


Yes and no. I tried the following:'product').then(function(products) {

And this still results into 0.


Hm, this is very strange. You see the data coming in your browser’s dev tools but that line (I suppose you only forgot the console.log in your example above) prints “0” in the console?


Well I’m not seeing it in the dev tools that the data gets returned from my service. But I’m testing against an apiary test service and they have a traffic monitoring tool. So that’s how I know that I’m getting the data back correctly.

The strange thing is that when I go through the code step by step, I can see that at a certain point I have an array with my data. But that data is getting lost somewhere for reasons unknown.


You may want to check to make sure that the serializer is extracting the data from the server properly.


Click on the network tab to view the server calls and make sure that for this case a request is actually being sent.


For some reason, it has decided to start working :open_mouth:

Thanks everybody for helping :blush: