Skip to content

Commit 6d57ffa

Browse files
committed
Fixed ForeignModel
1 parent f07c506 commit 6d57ffa

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/rorm/relations.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Foreign Keys
44

5-
You can use the type `ForeignKey<T>` where `T` is any type that derives
5+
You can use the type `ForeignModel<T>` where `T` is any type that derives
66
also `Model`. It will create a reference to the primary key of the
77
model `T`.
88

@@ -15,7 +15,7 @@ struct Post {
1515
#[rorm(id)]
1616
id: i64,
1717

18-
creator: ForeignKey<User>,
18+
creator: ForeignModel<User>,
1919
}
2020

2121
#[derive(Model)]
@@ -27,7 +27,7 @@ struct User {
2727

2828
!!! tip
2929

30-
You can point a `ForeignKey<T>` to the `Model` its contained in to
30+
You can point a `ForeignModel<T>` to the `Model` its contained in to
3131
build self-refenencing structs.
3232

3333
```rust
@@ -38,13 +38,13 @@ struct User {
3838
#[rorm(id)]
3939
id: i64,
4040

41-
creator: ForeignKey<Post>,
41+
creator: ForeignModel<Post>,
4242
}
4343
```
4444

4545
### Foreign keys on non-primary keys
4646

47-
With `ForeignKey` it is not possible to reference a non-primary key.
47+
With `ForeignModel` it is not possible to reference a non-primary key.
4848
In order to support this use case, the slightly more verbose
4949
`ForeignModelByField<T>` type was created.
5050

@@ -59,7 +59,7 @@ struct Post {
5959
#[rorm(id)]
6060
id: i64,
6161

62-
creator_aid: ForeignKeyByField<field!(User::F.another_id)>,
62+
creator_aid: ForeignModelByField<field!(User::F.another_id)>,
6363
}
6464

6565
#[derive(Model)]
@@ -76,7 +76,7 @@ struct User {
7676
## Backrefs
7777

7878
A backref is the (virtual) reference to be able to query
79-
"all items of a specific model with a `ForeignKey` pointing to the model on
79+
"all items of a specific model with a `ForeignModel` pointing to the model on
8080
which the backref is defined on."
8181

8282
```rust

0 commit comments

Comments
 (0)