Skip to content

Commit

Permalink
Fix Redux-ORM related model name (reduxjs#3412)
Browse files Browse the repository at this point in the history
* Fix Redux-ORM related model name

Also explain options using comments

See reduxjs#3400 (review)

* Remove superfluous comment
  • Loading branch information
haveyaseen authored and timdorr committed Apr 23, 2019
1 parent 8bc76bf commit 0ec197a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/recipes/structuring-reducers/UpdatingNormalizedData.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,11 @@ export class Comment extends Model {
return {
id: attr(),
text: attr(),
// Define a foreign key relation - one Post can have many Comments,
// at a field named "comments"
// Define a foreign key relation - one Post can have many Comments
postId: fk({
to: 'Comment',
as: 'post',
relatedName: 'comments'
to: 'Post', // must be the same as Post.modelName
as: 'post', // name for accessor (comment.post)
relatedName: 'comments' // name for backward accessor (post.comments)
})
}
}
Expand Down

0 comments on commit 0ec197a

Please sign in to comment.