Update "hasMany" example

This commit is contained in:
Ritchie Martori 2013-11-04 15:13:57 -08:00
parent 30df6cb597
commit e822e822cf
1 changed files with 13 additions and 15 deletions

View File

@ -48,14 +48,16 @@ The following is an example of an object containing two `Model` definitions: "lo
```js
{
"location": {
"dealership": {
// a reference, by name, to a dataSource definition
"dataSource": "my-db",
// the options passed to Model.extend(name, properties, options)
"options": {
"relationships": {
"hasMany": {
"model": "Inventory", "foreignKey": "locationId", "as": "inventory"
"cars": {
"type": "hasMany",
"model": "Car",
"foreignKey": "dealerId"
}
},
"remoteMethods": {
@ -76,25 +78,21 @@ The following is an example of an object containing two `Model` definitions: "lo
"address": "String"
}
},
"inventory": {
"car": {
"dataSource": "my-db"
"options": {
"plural": "inventory"
},
"properties": {
"id": {
"type": "String",
"required": true,
"id": true,
"length": 20
"id": true
},
"available": {
"type": "Number",
"required": false
"make": {
"type": "String",
"required": true
},
"total": {
"type": "Number",
"required": false
"model": {
"type": "String",
"required": true
}
}
}