ember.js Error: Assertion Failed: The response from a findAll must be an Array, not undefined

后端 未结 1 1101
庸人自扰
庸人自扰 2021-01-20 00:42

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(         


        
1条回答
  •  心在旅途
    2021-01-20 01:32

    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

    0 讨论(0)
提交回复
热议问题