Skip to content

Commit d7b943d

Browse files
committed
docs: update model options
1 parent e318449 commit d7b943d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/content/en/api/model-options.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ primaryKey() {
127127
### `relations`
128128
- Returns: `object`
129129

130-
This method can be implemented in the model to apply model instances to eager loaded relationships.
130+
This method can be implemented in the model to apply model instances to eager loaded relationships.
131+
It works for collections too.
131132

132133
It must return an object, which the key is the property of the relationship, and the value is the
133134
model instance.
@@ -137,7 +138,7 @@ See [Configuration](/configuration#eager-loaded-relationships)
137138
```js
138139
relations() {
139140
return {
140-
relationKey: RelationModel
141+
comments: Comment
141142
}
142143
}
143144
```
@@ -153,7 +154,7 @@ It must receive a model instance as argument.
153154
See [Configuration](/configuration#lazy-loading-relationships)
154155

155156
```js
156-
customMethod() {
157-
return this.hasMany(RelationModel)
157+
comments() {
158+
return this.hasMany(Comment)
158159
}
159160
```

0 commit comments

Comments
 (0)