4

Maybe this is the dumbest question ever but still - how to manually query server for the records of the certain model?

App.UrlNewRoute = Ember.Route.extend({
  setupController: function(controller, model) {
    console.dir(1);
    this.store.find('UrlType').then(function(url_types) {
      controller.set('urlTypes',url_types);
    });
  }
});    

{"url_types":[{"id":1,"caption":"text link"},{"id":2,"caption":"guest post"},{"id":3,"caption":"blog comment"},{"id":4,"caption":"banner"},{"id":5,"caption":"profile"},{"id":6,"caption":"review"}]}
Kingpin2k
  • 47,277
  • 10
  • 78
  • 96
lessless
  • 866
  • 10
  • 27

1 Answers1

2

totally legitimate question,

you should query it using camelCase:

this.store.find('urlType')

and your json key should be camelCase also (you can also use a serializer to fix it up):

{
   "urlTypes":[
      {
         "id":1,
         "caption":"text link"
      },
      {
         "id":2,
         "caption":"guest post"
      },
      {
         "id":3,
         "caption":"blog comment"
      },
      {
         "id":4,
         "caption":"banner"
      },
      {
         "id":5,
         "caption":"profile"
      },
      {
         "id":6,
         "caption":"review"
      }
   ]
}

http://emberjs.jsbin.com/OxIDiVU/301/edit

Kingpin2k
  • 47,277
  • 10
  • 78
  • 96
  • thank you, worked like a charm! is it possible to debug issue like this or its source shoult be "just known"? – lessless Mar 25 '14 at 11:43