AE
Ash Elixir•2y ago
cro

Unexpected token during mix ash_phoenix.gen.live

I'm creating a toy application for tracking weight lifting workouts. I have a WeightType resource that I want to create a LiveView for. When running the Ash Phoenix LiveView generator I'm getting the following error and having trouble tracking down where it comes from so I can fix it. Help?
mix ash_phoenix.gen.live Mitochex.Workouts Mitochex.Workouts.WeightType
Would you like to name your actor? For example: `current_user`. If you choose no, we will not add any actor logic. [Yn] n
Please provide a plural_name. For example the plural of tweet is tweets.
You can press enter to abort, and then configure one on the resource, for example:

resource do
plural_name "tweets"
end
> weight_types
** (SyntaxError) lib/mitochex_web/live/weight_type_live/index.ex:80:87: unexpected token: }

HINT: the "(" on line 80 is missing terminator ")"

|
80 | |> assign(:weight_type, Mitochex.Workouts.get!(Mitochex.Workouts.WeightType, id)})
| ^
(elixir 1.15.5) lib/code.ex:945: Code.format_string!/2
(mix 1.15.5) lib/mix/tasks/format.ex:600: Mix.Tasks.Format.elixir_format/2
(ash_phoenix 1.2.17) lib/ash_phoenix/gen/live.ex:162: AshPhoenix.Gen.Live.write_formatted_template/5
(ash_phoenix 1.2.17) lib/ash_phoenix/gen/live.ex:97: AshPhoenix.Gen.Live.generate/3
(mix 1.15.5) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
(mix 1.15.5) lib/mix/cli.ex:92: Mix.CLI.run_task/2
/Users/cro/.local/share/rtx/installs/elixir/1.15.5-otp-26/bin/mix:2: (file)
mix ash_phoenix.gen.live Mitochex.Workouts Mitochex.Workouts.WeightType
Would you like to name your actor? For example: `current_user`. If you choose no, we will not add any actor logic. [Yn] n
Please provide a plural_name. For example the plural of tweet is tweets.
You can press enter to abort, and then configure one on the resource, for example:

resource do
plural_name "tweets"
end
> weight_types
** (SyntaxError) lib/mitochex_web/live/weight_type_live/index.ex:80:87: unexpected token: }

HINT: the "(" on line 80 is missing terminator ")"

|
80 | |> assign(:weight_type, Mitochex.Workouts.get!(Mitochex.Workouts.WeightType, id)})
| ^
(elixir 1.15.5) lib/code.ex:945: Code.format_string!/2
(mix 1.15.5) lib/mix/tasks/format.ex:600: Mix.Tasks.Format.elixir_format/2
(ash_phoenix 1.2.17) lib/ash_phoenix/gen/live.ex:162: AshPhoenix.Gen.Live.write_formatted_template/5
(ash_phoenix 1.2.17) lib/ash_phoenix/gen/live.ex:97: AshPhoenix.Gen.Live.generate/3
(mix 1.15.5) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
(mix 1.15.5) lib/mix/cli.ex:92: Mix.CLI.run_task/2
/Users/cro/.local/share/rtx/installs/elixir/1.15.5-otp-26/bin/mix:2: (file)
6 Replies
kernel
kernel•2y ago
yeah
|> assign(:weight_type, Mitochex.Workouts.get!(Mitochex.Workouts.WeightType, id)})`
|> assign(:weight_type, Mitochex.Workouts.get!(Mitochex.Workouts.WeightType, id)})`
should be
|> assign(:weight_type, Mitochex.Workouts.get!(Mitochex.Workouts.WeightType, id))}
|> assign(:weight_type, Mitochex.Workouts.get!(Mitochex.Workouts.WeightType, id))}
swap the } and ) at the end of the line 🙂
ZachDaniel
ZachDaniel•2y ago
Oops! Can you open an issue on ash phoenix about this?
cro
croOP•2y ago
Sure.
cro
croOP•2y ago
GitHub
Syntax error in ash_phoenix.gen.live generated code. · Issue #100 ·...
Describe the bug I'm creating a toy application for tracking weight lifting workouts. I have a WeightType resource that I want to create a LiveView for. When running the Ash Phoenix LiveView ge...
cro
croOP•2y ago
ZachDaniel
ZachDaniel•2y ago
yes, thanks!

Did you find this page helpful?