diff --git a/lib/arrow_web/live/shuttle_live/shuttle_live.ex b/lib/arrow_web/live/shuttle_live/shuttle_live.ex index 9de4076d..48ff446c 100644 --- a/lib/arrow_web/live/shuttle_live/shuttle_live.ex +++ b/lib/arrow_web/live/shuttle_live/shuttle_live.ex @@ -20,7 +20,7 @@ defmodule ArrowWeb.ShuttleViewLive do <.simple_form :let={f} for={@form} - as={:shuttle_route} + as={:shuttle} action={@http_action} phx-submit={@action} id="shuttle-form" @@ -120,7 +120,7 @@ defmodule ArrowWeb.ShuttleViewLive do |> assign(:form, form) |> assign(:form_action, "edit") |> assign(:http_action, ~p"/shuttles/#{id}") - |> assign(:shuttle_route, shuttle) + |> assign(:shuttle, shuttle) |> assign(:title, "edit shuttle") |> assign(:gtfs_disruptable_routes, gtfs_disruptable_routes) |> assign(:shapes, shapes) @@ -155,17 +155,17 @@ defmodule ArrowWeb.ShuttleViewLive do {:ok, socket} end - def handle_event("validate", %{"shuttle_route" => shuttle_route_params}, socket) do + def handle_event("validate", %{"shuttle" => shuttle_params}, socket) do form = - %Shuttle{} |> Shuttles.change_shuttle(shuttle_route_params) |> to_form(action: :validate) + %Shuttle{} |> Shuttles.change_shuttle(shuttle_params) |> to_form(action: :validate) {:noreply, assign(socket, form: form)} end - def handle_event("edit", %{"shuttle_route" => shuttle_route_params}, socket) do - shuttle = Shuttles.get_shuttle!(socket.assigns.shuttle_route.id) + def handle_event("edit", %{"shuttle" => shuttle_params}, socket) do + shuttle = Shuttles.get_shuttle!(socket.assigns.shuttle.id) - case Arrow.Shuttles.update_shuttle(shuttle, shuttle_route_params) do + case Arrow.Shuttles.update_shuttle(shuttle, shuttle_params) do {:ok, shuttle} -> {:noreply, socket @@ -177,8 +177,8 @@ defmodule ArrowWeb.ShuttleViewLive do end end - def handle_event("create", %{"shuttle_route" => shuttle_route_params}, socket) do - case Arrow.Shuttles.create_shuttle(shuttle_route_params) do + def handle_event("create", %{"shuttle" => shuttle_params}, socket) do + case Arrow.Shuttles.create_shuttle(shuttle_params) do {:ok, shuttle} -> {:noreply, socket diff --git a/test/arrow_web/live/shuttle_live/shuttle_live_test.exs b/test/arrow_web/live/shuttle_live/shuttle_live_test.exs index 49cefb1a..7d7d7a65 100644 --- a/test/arrow_web/live/shuttle_live/shuttle_live_test.exs +++ b/test/arrow_web/live/shuttle_live/shuttle_live_test.exs @@ -77,7 +77,7 @@ defmodule ArrowWeb.ShuttleLiveTest do {:ok, conn} = new_live - |> form("#shuttle-form", shuttle_route: @create_attrs) + |> form("#shuttle-form", shuttle: @create_attrs) |> render_submit() |> follow_redirect(conn) @@ -90,7 +90,7 @@ defmodule ArrowWeb.ShuttleLiveTest do test "renders errors when data is invalid", %{conn: conn} do {:ok, new_live, _html} = live(conn, ~p"/shuttles/new") - assert new_live |> form("#shuttle-form", shuttle_route: @invalid_attrs) |> render_submit() =~ + assert new_live |> form("#shuttle-form", shuttle: @invalid_attrs) |> render_submit() =~ "can't be blank" end end @@ -104,7 +104,7 @@ defmodule ArrowWeb.ShuttleLiveTest do {:ok, conn} = edit_live - |> form("#shuttle-form", shuttle_route: @update_attrs) + |> form("#shuttle-form", shuttle: @update_attrs) |> render_submit() |> follow_redirect(conn) @@ -115,7 +115,7 @@ defmodule ArrowWeb.ShuttleLiveTest do test "renders errors when data is invalid", %{conn: conn, shuttle: shuttle} do {:ok, new_live, _html} = live(conn, ~p"/shuttles/#{shuttle}/edit") - assert new_live |> form("#shuttle-form", shuttle_route: @invalid_attrs) |> render_submit() =~ + assert new_live |> form("#shuttle-form", shuttle: @invalid_attrs) |> render_submit() =~ "can't be blank" end end