Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document LiveView controller example requiring Phoenix controller #1672

Merged
merged 3 commits into from Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/phoenix_live_view/controller.ex
Expand Up @@ -19,8 +19,11 @@ defmodule Phoenix.LiveView.Controller do
## Examples

defmodule ThermostatController do
...
import Phoenix.LiveView.Controller
use MyAppWeb, :controller

# "use MyAppWeb, :controller" should import Phoenix.LiveView.Controller.
# If it does not, you can either import it there or uncomment the line below:
# import Phoenix.LiveView.Controller

def show(conn, %{"id" => thermostat_id}) do
live_render(conn, ThermostatLive, session: %{
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/router.ex
Expand Up @@ -301,7 +301,7 @@ defmodule Phoenix.LiveView.Router do

## Examples

defmodule AppWeb.Router do
defmodule MyAppWeb.Router do
use LiveGenWeb, :router
import Phoenix.LiveView.Router

Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/test/live_view_test.ex
Expand Up @@ -213,7 +213,7 @@ defmodule Phoenix.LiveViewTest do
## Examples

{:ok, view, html} =
live_isolated(conn, AppWeb.ClockLive, session: %{"tz" => "EST"})
live_isolated(conn, MyAppWeb.ClockLive, session: %{"tz" => "EST"})

Use `put_connect_params/2` to put connect params for a call to
`Phoenix.LiveView.get_connect_params/1` in `c:Phoenix.LiveView.mount/3`:
Expand Down