Skip to content

Commit

Permalink
Improve docs for order by on through preloads, closes #4330
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Nov 30, 2023
1 parent f870489 commit 4bd63cc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/ecto/query.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2597,9 +2597,13 @@ defmodule Ecto.Query do
Repo.all from p in Post, preload: [comments: ^comments_query]
Similarly, if you have a `:through` association, such as posts has many authors
through comments (`posts->comments->authors`), the query will only customize the
relationship between comments and authors, even if preloaded through posts.
Similarly, if you have a `:through` association, such as posts has many
`comments_authors` through comments (`posts->comments->comments_authors`),
the query will only customize the relationship between comments and
comments_authors, even if preloaded through posts. This means `order_by`
clauses on `:through` associations affect only the direct relationship
between `comments` and `comments_authors`, not between `posts` and
`comments_authors`.
## Preload functions
Expand Down

0 comments on commit 4bd63cc

Please sign in to comment.