cro
cro
AEAsh Elixir
Created by cro on 9/14/2023 in #support
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)
9 replies
AEAsh Elixir
Created by cro on 4/9/2023 in #support
Where is the right place to perform transformation on form data before database insert?
Greetings, I have a form that will contain plain text in AsciiDoc format. I would like to convert the AsciiDoc to HTML and store it alongside the original in the database. I'm having a hard time understanding where the best place to do this is. I thought it would be a good candidate for an Ash Calculation, but the examples don't seem to deal with this kind of thing, so I wondered if it was an anti-pattern. In the spirit of "try the simplest thing that will work", I could just do it in the handle_events for creating and updating the resources. Is that a decent approach? Am I overthinking it?
7 replies
AEAsh Elixir
Created by cro on 3/13/2023 in #support
Getting Started with Ash and Phoenix Blog question
In the ash_phoenix tutorial where it talks about creating the Registry, shouldn't

entry MyAshPhoenixApp.Blog.Post

entry MyAshPhoenixApp.Blog.Post
be

entry MyAshPhoenixApp.Blog.Resources.Post

entry MyAshPhoenixApp.Blog.Resources.Post
? And then a little further down the page it says that it's convention to place resources in the resources directory, but the filenames and defmodule statements below still have post.ex in the blog/ directory.
5 replies
AEAsh Elixir
Created by cro on 2/21/2023 in #support
How can I add fields to the default AshAuthentication signup form?
I see which modules are being called but I don't know how to add new fields to registration (first name, last name, cell #, etc.). Are there docs for this and I just missed them?
7 replies
AEAsh Elixir
Created by cro on 2/6/2023 in #support
Adding elixir_sense to mix.exs seems to break autocomplete
Hi folks, I setup a new Ash project tonight, following the documentation for AshAuthentication. I added elixir_sense to mix.exs but this seems to be breaking autocomplete and other LSP functions. In case there is some difference between nvim and VS Code I tried both, but have the same issue. In the LSP logfile that nvim generates I see:
[WARN][2023-02-05 19:07:58] ...lsp/handlers.lua:487 "warning: undefined function add_first_alias_positions/3 (expected ElixirSense.Core.MetadataBuilder to define such a function or for it to be imported, but none are available)\n lib/elixir_sense/core/metadata_builder.ex:739\n"
[WARN][2023-02-05 19:07:58] ...lsp/handlers.lua:487 'could not compile dependency :elixir_sense, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile elixir_sense", update it with "mix deps.update elixir_sense" or clean it with "mix deps.clean elixir_sense"'
[WARN][2023-02-05 19:07:58] ...lsp/handlers.lua:487 "warning: undefined function add_first_alias_positions/3 (expected ElixirSense.Core.MetadataBuilder to define such a function or for it to be imported, but none are available)\n lib/elixir_sense/core/metadata_builder.ex:739\n"
[WARN][2023-02-05 19:07:58] ...lsp/handlers.lua:487 'could not compile dependency :elixir_sense, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile elixir_sense", update it with "mix deps.update elixir_sense" or clean it with "mix deps.clean elixir_sense"'
Ideas on how to overcome this? Or should I open an issue over in the Github Elixir Sense repo?
11 replies