Skip to content

Commit

Permalink
Correct verified route paths in routing guide (phoenixframework#5468)
Browse files Browse the repository at this point in the history
  • Loading branch information
csmcanarney authored May 24, 2023
1 parent 1af7629 commit b0f51a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions guides/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ When building paths for nested routes, we will need to interpolate the IDs where
```elixir
user_id = 42
post_id = 17
~p"/users/#{user_id}/#{post_id}"
~p"/users/#{user_id}/posts/#{post_id}"
"/users/42/posts/17"
```

Verified routes also support the `Phoenix.Param` protocol, but we don't need to concern ourselves with elixir protocols just yet. Just know that once we start building our application with structs like `%User{}` and `%Post{}`, we'll be able to interpolate those data structures directly into our `~p` paths and phoenix will pluck out the correct fields to use in the route.

```elixir
~p"/users/#{user}/#{post}"
~p"/users/#{user}/posts/#{post}"
"/users/42/posts/17"
```

Expand Down

0 comments on commit b0f51a5

Please sign in to comment.