Skip to content

Commit 0001ecf

Browse files
authored
associations.cheatmd: Fix many_to_many example schemas
1 parent 7fd33e2 commit 0001ecf

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

guides/cheatsheets/associations.cheatmd

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,11 @@ end
124124
#### The first schema
125125

126126
```elixir
127-
defmodule Movie do
127+
defmodule User do
128128
use Ecto.Schema
129129

130-
schema "movies" do
131-
field :title, :string
132-
field :release_date, :date
133-
many_to_many :actors, Actor, join_through: "movies_actors"
130+
schema "users" do
131+
many_to_many :organizations, Organization, join_through: "users_organizations"
134132
end
135133
end
136134
```
@@ -139,12 +137,11 @@ end
139137
#### The second schema
140138

141139
```elixir
142-
defmodule Actor do
140+
defmodule Organization do
143141
use Ecto.Schema
144142

145-
schema "actors" do
146-
field :name, :string
147-
many_to_many :movies, Movie, join_through: "movies_actors"
143+
schema "organizations" do
144+
many_to_many :users, Organization, join_through: "users_organizations"
148145
end
149146
end
150147
```

0 commit comments

Comments
 (0)