Skip to content

Commit

Permalink
Fix typo in Contexts Guide (#5645)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhcarvalho authored Nov 23, 2023
1 parent 2d9c11f commit 443dfb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion guides/contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ defmodule HelloWeb.CartController do
end
```

We defined a new cart controller to handle the `get "/cart"` route. For showing a cart, we render a `"show.html"` template which we'll create in moment. We know we need to allow the cart items to be changed by quantity updates, so right away we know we'll need a cart changeset. Fortunately, the context generator included a `ShoppingCart.change_cart/1` function, which we'll use. We pass it our cart struct which is already in the connection assigns thanks to the `fetch_current_cart` plug we defined in the router.
We defined a new cart controller to handle the `get "/cart"` route. For showing a cart, we render a `"show.html"` template which we'll create in a moment. We know we need to allow the cart items to be changed by quantity updates, so right away we know we'll need a cart changeset. Fortunately, the context generator included a `ShoppingCart.change_cart/1` function, which we'll use. We pass it our cart struct which is already in the connection assigns thanks to the `fetch_current_cart` plug we defined in the router.

Next, we can implement the view and template. Create a new view file at `lib/hello_web/controllers/cart_html.ex` with the following content:

Expand Down

0 comments on commit 443dfb3

Please sign in to comment.