Ash Framework

AF

Ash Framework

The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.

Join

support

showcase

today-i-learned

Polymorphic Embedded Resources?

Is it possible to have embedded resources be one or more structs for example ```defmodule MainResource do...

Identity not creating unique index

I have a resource with an identity: ```elixir attributes do uuid_primary_key :id ...

AshPhoenix form handling

Question about Ash Phoenix forms. When using ecto and assign_form the names in the form are user[active] for the active field of user schema. For AshPhoenix forms with assign(:form, form) the names are form[active] so it does not know the resource type when building the form. Is there another way to deal with this so the forms do have the resource name in the element names, or do I just need to change the js that was using the old names? This also impacts the LiveView tests using the form he...

How to login with a generated Magic Link in Phoenix (ash_authentication ash_phoenix_authentication)

I'm trying to implement the new Magic Link strategy in ash_authentication. I can succesfully send an email with a magic link token, but how do I use that token to then login the user? For example with password reset, the token goes in the url, and that works, I'd imagine you have to do something similar with a magic link, but that route doesn't seem to be available. This is what mix phx.routes returns, where there's no room to put a token. ```elixir auth_path * /auth/user/magic_link/request ExampleWeb.AuthController {:user, :magic_link, :request}...

Prevent action's changes from being run on `AshPhoenix.Form.validate`

Hello, I have an resource A that has a filed let's say capacity , belongs_to relationship to B resource and create action that has a change LoadDefaultFromRelationship . This change basically fetches the capacity from B resource if none was given in the create action params for A. The problem with such approach is that every time we invoke the AshPhoenix.Form.validate it makes a query to the database for this default value. Is there any way to prevent this change being run on AshPhoenix.Form.validate but still apply on create action?...

submit_errors: [id: {"has already been taken", []}],

When a for_create form is submitted, I get this error. Assuming the id it's referring to is "form", I'm not sure why it thinks it has been taken. ``` api: MyApp.Tweets, method: "post",...

Aggregates still not working correctly

I have a few custom aggregates that have a filter on them that don't seem to work anymore. ```elixir BackOffice.Vehicle |> Ash.Query.aggregate(:pending_jobs_today_count, :count, :jobs, filter: expr(status == "pending")) ...

Could not relate to actor, as no actor was found (and :allow_nil? is false

When I submit a form that triggers :create action which contains change relate_actor(:author), I get this error. What causes no actor to be found despite that there is a logged in user? ``` submit_errors: [ author: {"Could not relate to actor, as no actor was found (and :allow_nil? is false)",...

Support for Postgres generated columns

Postgres supports creating columns that are generated when the row is inserted, updated. In my case, I have a property that has its address separated into multiple columns and I want to create a special field that will have the concatenation of all these fields. I was wondering if AshPostgres has support for that feature....

Support GIST indexes in `custom_indexes` code block

Do Ash Postgres supports more complex indexes in custom_indexes? Right now I'm using custom_statements for it: ```elixir...

Self-referencing a Resource

Question: How do I self-reference a Resource? Detail Description: I have a Person table. I want to describe that he is related to another Person(s). I don't need to know relationship type, except that they are related/know each other Technical Description: Person A :has_many Persons(s) ?...

MyApp.Secrets must implement the 'AshAuthentication.Secret` behaviour.

I followed the example here (https://ash-hq.org/docs/guides/ash_authentication/latest/github-quickstart) but ran into this error. It talks about password_reset which I'm not sure where it's coming from. ``` (EXIT from #PID<0.104.0>) an exception was raised: (Spark.Error.DslError) [nil]...

`bulk_create` requiring `upsert_fields` with `upsert?: true`

Small conflict between the docs and usage of bulk_create: Docs: "If not set, the action's upsert_fields is used, and if that is not set, then any fields not being set to defaults are written." https://hexdocs.pm/ash/Ash.Api.html#c:bulk_create/4 ...

AshPhoenix.Form does not implement the Access behaviour

I'm having this problem when I try to use AshPhoenixForms. I have a liveview with this mount function: ```elixir @impl true def mount(_conn, _session, socket) do...
No description

Custom reset password flow not passing policy checks

I have a custom live view with a reset password form. ```elixir AshPhoenix.Form.for_read(User, :request_password_reset_with_password, api: Iterup.Users) |> to_form()...

About policies

It seems that policies are not triggered. I found this and tried but without success. https://discord.com/channels/711271361523351632/1079519120971812914 ```elixir...

Use a custom operator on FilterForm

Is it possible to expand FilterForm to allow other types of operators like using ilike or <% during filtering? I believe that this item will give a solution for that https://github.com/ash-project/ash/issues/374 but AFAIK this is not done yet. So, for now is there a workaround?...

How to create organization after user creation.

Ideally it would create organization for user after registration, but if user comes from invitation (to specific organization) than it does not create new one. No functionality is created yet, im not sure, how to even approach this. In user resource there isnt even actions for create. Apparently its definition happens somewhere in i suppose....

Adding macros to `expr/1`

I'd like to add the st_* macros from GeoPostGIS to expr/1, possibly more in future. These macros do generate exactly the fragment syntax that is currently supported by expr, which is pretty nice, but they don't work as-is. Is doesn't look like it's possible currently to extend Ash.Expr, and I'm quite interested in changing that, or at least making it possible to mix in external macros in this way using the existing supporting constructs like fragment. Has there been any interest/thought up to now on this topic?...

Adding a Notifier breaks elixir_sense autocompletions

I have recently added an ash Notifier to my project, and it has caused the elixir_sense plugin to throw an error when trying to show documentation. It is attempting to call .sections() on my notifier, but there is no spark DSL for notifiers. ```elixir [Error - 11:47:38] Request textDocument/completion failed. Message: an exception was raised:...