Ash Elixir

AE

Ash Elixir

Join the community to ask questions about Ash Elixir and get answers from other members.

Join

support

showcase

today-i-learned

Absinthe compilation error

Any ideas what might be triggering this? ``` == Compilation error in file lib/app/schema.ex == ** (KeyError) key :location not found in: nil. If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map...

JsonB sorting within Resource.actions

I have a Resource with a jsonb column called metadata How do I default sort by `metadata ->> 'CreatedDate'? ```...

BulkCreate upsert not working

I'm using a BulkCreate action but it seems not to upsert correctly:
No description

Returns type

I have a actions likes this elixir ``` update :update_user, :update_user do read_action :get_by_token identity false...

`Spark` templates

I have a number of resource templates that are defined as __using__ macros, primarily for the sake of ergonomics and readability. As some of these have begun to solidify, I have converted them to Spark extensions. What I'm wondering is if we can have the best of both worlds. For example, by allowing extensions to provide a Spark options schema and selecting a syntax to walk in Spark.Dsl.Fragment (or a new Spark.Dsl.Template) in order to inject options into the fragment/template. This would be even more interesting if extensions were able to inject other extensions with options taken from their own DSL, but this may be a harder hill to climb....

Setting Actor from Ash.Authentication

Is the actor automatically set or must I do that in my live session on_mount?

Can an extension add a notifier/fragment?

Quick poke leads me to believe this is the same as asking whether an extension can add other extensions, since notifiers and fragments are just special kinds of extensions.

Intercept Identities Behaviour

I have this code elixir ``` identities do identity :email, [:email] identity :confirmation_token, [:confirmation_token]...

Bulk Delete/Truncate

What is the best way to delete all resources that pass a filter, or in some cases truncate a table to ensure it is empty. This is mostly for admin type functions to reset after some issue with normal operation where the data can be reloaded afterwards.

Fetching descendants in calculation

I've created a listings resource/table which is nestable via a parent_listing_id attribute. In a calculation I want to find all descendants for a listing, what's the best way to do this?

Policy for action stopped being called

In my User resource, I have this action: ```elixir update :confirm_phone_number do alias Actions.ConfirmPhoneNumber.Changes...

atom attribute called status creates errors with latest ash_graphql

I just updated ash_graphql version to 0.25.4 and after doing that I get an error when compiling the project. Seems like the problem is related to this attribute I have in my Offer resource: ```elixir...

LiveView uploads with AshPhoenix.Form

Hello, I've got a form that allows the user to select from a few example images, or to upload their own and use that. Right now it's a set of radio buttons plus a live_file_input. I've gotten it ~working but it feels pretty dirty and hacky with some showstopping bugs so I'm looking for prior art and best practices when it comes to the Ash Way to do live uploads. ...

Modeling Context Multitenancy

The goal is to have a Tenant be identified by a subdomain (I think this is the common usage). I want to use schema/context multitenancy. There is a User resource in the "master" database (master registry?) who are admins that manage tenants. There is another User resource (ideally inheriting from the master User) that represents a user in a tenant. I'm getting back to this thread a month later: https://discord.com/channels/711271361523351632/1098462406109311108/1098614600917852231 in which @Zach...

Modeling roles for access control

Role enforcement will be done via policies. Is it better to add each role to a User as a property or should I create a Role resource and add a relationship between User and Role? Seems like having a separate Role relationship would make pick screens easier; otherwise I'd probably be hard-coding them.

Annotating manual actions and custom changes for policies

My current understanding is that policy builtins like changing and selecting won't see into manual actions at all, and that they will see into custom changes to the degree expressed by the returned changeset and not further. In the case that one requires a manual action, or to overcome any limitations for custom changes, is it possible to annotate the action, indicating to Ash that the manual is going to affect certain attributes or otherwise do things that a policy might care about?...

Bulk create action Changeset Error

I'm using bulk create action with upsert and I'm tryong to test that not valid resources will not be created. ```elixir resources = input.resources_attributes |> MmsBiztalk.bulk_create!(...

Can override `sign_in_route`, but not `reset_route` for AshAuthenticationPhoenix

I have the :input_class and some other things customized in some overrides, and I'm attempting to apply the overrides to all the routes: ```elixir sign_in_route overrides: [HsmWeb.AuthOverrides, AshAuthentication.Phoenix.Overrides.Default] sign_out_route AuthController...
No description

Custom validation example

It would be very helpful to have an example validation in the docs for custom validations. I am getting hung up creating an error that implements the form error protocol. The following generates an error but is then stripped out before rending the form. error = Ash.Error.to_ash_error("Domain or company is required")...

Log in with username and password in Phoenix app

Does ash auth Phoenix have a declarative way to log in with username instead of email address? I changed my resources but it looks like I need to change something else.