Skip to content

Commit b918c48

Browse files
haveyaseentimdorr
authored andcommitted
Fix Redux-ORM related model name (#3412)
* Fix Redux-ORM related model name Also explain options using comments See #3400 (review) * Remove superfluous comment
1 parent da3d89f commit b918c48

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/recipes/structuring-reducers/UpdatingNormalizedData.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,11 @@ export class Comment extends Model {
227227
return {
228228
id: attr(),
229229
text: attr(),
230-
// Define a foreign key relation - one Post can have many Comments,
231-
// at a field named "comments"
230+
// Define a foreign key relation - one Post can have many Comments
232231
postId: fk({
233-
to: 'Comment',
234-
as: 'post',
235-
relatedName: 'comments'
232+
to: 'Post', // must be the same as Post.modelName
233+
as: 'post', // name for accessor (comment.post)
234+
relatedName: 'comments' // name for backward accessor (post.comments)
236235
})
237236
}
238237
}

0 commit comments

Comments
 (0)