1

我不确定为我的“特定”json数据构建我的商店https://gist.github.com/63fb3294a126a8150373#file-gistfile1-json

适配器

AppAdapter = DS.Adapter.extend
  findAll: (store, type) ->
    url = type.url
      $.ajax
        url: url
        dataType: 'json'
        context: store
        success: (response) =>
          response = response[0]
          @loadMany(type, response.data)

楷模

App.Party = DS.Model.extend
  _id           : DS.attr 'string'
  name          : DS.attr 'string'
  lineup        : DS.attr 'string'
  begin_at      : DS.attr 'string'
  end_at        : DS.attr 'string'
  description   : DS.attr 'string'
  party_type    : DS.attr 'string'
  funny_rate    : DS.attr 'number'
  girls_rate    : DS.attr 'number'
  price_rate    : DS.attr 'number'
  place_id      : DS.attr 'string'
  begin_at_tmsp : DS.attr 'date'
  end_at_tmsp   : DS.attr 'date'
  digitick      : DS.attr 'string'
  # date          : DS.belongsTo 'App.Day'
  # place         : DS.belongsTo 'App.Place'
  # places        : DS.belongsTo 'App.Place'


App.Place = DS.Model.extend
  _id           : DS.attr 'string'
  city          : DS.attr 'string'
  description   : DS.attr 'string'
  gal_rating    : DS.attr 'string'
  latitude      : DS.attr 'string'
  location      : DS.attr 'string'
  longitude     : DS.attr 'string'
  name          : DS.attr 'string'
  postal_code   : DS.attr 'string'
  street        : DS.attr 'string'
  total_points  : DS.attr 'string'
  total_rating  : DS.attr 'string'
  # parties       : DS.hasMany 'App.Party'

我总是收到错误

'对象[对象对象]没有方法'loadMany'

你能帮忙吗 ?

4

0 回答 0