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