关系必须是键/值对

时间:2016-03-24 23:27:25

标签: ember.js firebase

收到以下错误:

firebase.js:119 Uncaught Error: thunder@model:provider: relationship hasMany('address') must be a key/value map. Example: { "address": { "address_1": true } } instead got: "-KDehK2aAE15KEQXjHC-"

我尝试了很多不同的方式,而我却迷失了方向。我知道我遗漏了一些简单的东西,只是不知道在哪里

地址模型

export default DS.Model.extend({
  city: DS.attr('string'),
  state: DS.attr('string'),
  street: DS.attr('string'),
  zip: DS.attr('string'),
  provider: DS.belongsTo('provider')
});

提供者模型

export default DS.Model.extend({
  category: DS.attr('string'),
  status: DS.attr('boolean'),
  name: DS.attr('string'),
  description: DS.attr('string'),
  address: DS.hasMany('address', {async: true}),
  phone: DS.attr('string'),
  email: DS.attr()
});

以下是我在Firebase中的内容

{
  "addresses" : {
    "-KDfELHB6F7_-luBeGpb" : {
      "city" : "King of Prussia",
      "state" : "PA",
      "street" : "135 Main Street",
      "zip" : "19406"
    }
  },
  "providers" : {
    "-KDfEQdjZm8uhOUMkRg3" : {
      "address" : "-KDfELHB6F7_-luBeGpb",
      "category" : "Tutoring",
      "description" : "Apple Uber UI Full stack guy",
      "email" : "johnservice@test.com",
      "name" : "John's Services",
      "phone" : "215-555-9999",
      "status" : true
    }
  }
}

0 个答案:

没有答案