dblack
AEAsh Elixir
•Created by dblack on 4/10/2023 in #showcase
One-to-many Form Example
I've put together a little example of using AshPhoenix.Form to build an interactive one-to-many form: https://github.com/totaltrash/form_example
I picked up Ash around the same time I got into Elixir (both Ash and Surface blew my mind at the time, so much declarative goodness). As I've never really worked with Ecto directly, I absolutely loved this post (https://kobrakai.de/kolumne/one-to-many-liveview-form) on building a one-to-many form using Ecto changesets - I began to understand how Ecto was never built with this interactive use case in mind, and the complexities involved of rolling your own solution. AshPhoenix.Form just handles this stuff out of the box, so I had to model something similar using Ash and AshPhoenix.
4 replies
AEAsh Elixir
•Created by dblack on 3/29/2023 in #showcase
Filter Form Example
I was doing a bit of a proof of concept with AshPhoenix.FilterForm, so I thought I'd roll up a little example application: https://github.com/totaltrash/filter_form_example
Hopefully it might be useful to anyone who wants to try out complex nested filter forms.
5 replies
AEAsh Elixir
•Created by dblack on 3/28/2023 in #support
`form_for` deprecation warning when using FilterForm
I'm getting a deprecation warning filling up the terminal (I'll blame that for the earlier inspect non-issue!):
Line 65 of my component is the call to
<.inputs_for :let={components} field={@component[:components]}>
... I think the warning is referring to the call to form_for at https://github.com/ash-project/ash_phoenix/blob/main/lib/ash_phoenix/filter_form/filter_form.ex#L948 but not totally sure11 replies
AEAsh Elixir
•Created by dblack on 3/28/2023 in #support
FilterForm inspect strange behavior
I'm just playing around with FilterForm and I'm seeing some weird inspect behavior, which is not making it easy to reason with what's going on. For instance:
Gives me:
I would have expected a
FilterForm
struct. I've validated that filter_form
is actually a FilterForm
and not a FilterForm.Predicate
? Is this a bug with the inspect protocol for FilterForm's or am I totally misunderstanding something (likely)!15 replies
AEAsh Elixir
•Created by dblack on 3/1/2023 in #support
Error with composite `{:array, :atom}` field
I've started to get the following error for no apparent reason - the app was working fine, I've just updated deps and this happens inconsistently (sometime the app works fine, then I'll restart the dev server and it will be broken):
cannot load ``["admin"]`` as type {:array, {:parameterized, Ash.Type.Atom.EctoType, []}} for field :roles in #Crm.Accounts.User
The attribute looks like:
2 replies
AEAsh Elixir
•Created by dblack on 2/19/2023 in #support
Concat with nil values
The built in concat calculation returns nil when any of the values it is concating is nil. I need a nil friendly concat and I could use something like this (which only works on the data layer and is postgres specific):
I'd prefer to write a custom calculation that I can reuse (so the calculation can be run in Ash land after the record is retrieved from the db), but if I create a custom calculation (to use
concat_ws
) it is still only going to be suitable only for postgres datalayer. Is there a way that ash_postgres could use concat
instead of ||
as an option?
I'm probably overthinking it and should just use the above calc and move on!55 replies