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

Can I reuse the AshPostgres filter conversion to Ecto for my own manual reads?

I'm trying to use Ash in a project where I have to support existing MSSQL Repos for a while. I thought I can solve this with ManualRead and got quite far, but now I'm trying to translate the Ash.Query occurrences to Ecto.Query and am out of my depth. I also tried to find the place in AshPostgres, where they are converted but was quite lost. Can anyone point me in the right direction to solve this?...

code_interface not expose function

Hi guys, I have a resource like this: ```elixir defmodule OrangeCms.Content.ContentType do use Ash.Resource,...

How to use AshPhoenix.Form with the default core_components file that comes with Phoenix 1.7?

Phoenix 1.7 has updated the core_components file that comes with mix phx.new which means we need to change the way we use AshPhoenix.Form to play nicely with the updated form components. From what I gathered in some of the previous conversations, the way to do it in the new component should be as follows. When calling <.simple_form />, the :let should removed so it would look like this:...

Adding a embedded resource to a resource is failing

I have this embedded resource: ```elixir defmodule Marketplace.Markets.Property.Image do use Ash.Resource,...

Nested form example

While applying the example on this page to my project, https://ash-hq.org/docs/module/ash_phoenix/latest/ashphoenix-form, I ran into this error.
no case clause matching: [#Tweets.Item<...
no case clause matching: [#Tweets.Item<...
Can you please give me some pointers?...

Phone number confirmation with Twilio

Hey guys, I wanted to replace the current AshAuthentication confirmation by email add-on with one that will use Twilio Verify API so I can verify the user's phone number. I just finished it, so I was wondering if you guys could give your suggestions about the implementation and if you see any apparent problems with it: So, the first step is the Twilio Verify API implementation, I used `Finch`` for that:...

Makes change respect order

So, let's say I have an update or create action where I want to do a bunch of changes in order before the action runs: ```elixir update :my_update do ......

How to run something in the background after action?

Hi, I tried using notifiers but it looks like they block. Is there a way to run something in the background that is triggered by an actions e.g. user_created, etc

How to set a default value for AshPhoenix.Form.for_action ?

I have a Resource that has a foreign key in it which I assign as a hidden field in my form. How do I make it so that I can fill out the foreign key field when calling AshPhoenix.Form.for_action or AshPhoenix.Form.for_create?...

Customizing AshAuthentication.Phoenix

According to https://hexdocs.pm/ash_authentication_phoenix/AshAuthentication.Phoenix.html there are several ways to customise the authentication process: 1. Use the generic sign-in liveview - AshAuthentication.Phoenix.SignInLive.Apply 2. overrides using AshAuthentication.Phoenix.Overrides to set your own CSS classes for all components. 3. Build your own sign-in pages using the pre-defined components. 4. Build your own sign-in pages using the generated auth routes....

Remove register and password reset links from AshAuthentication.Phoenix sign-in page

Basically I was wondering if there is some way to remove these two links from the page (see image) without having to rewrite the whole sign-in page from scratch
No description

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:...

require authenticated user

Hi,Im still new to elixir and phoenix. I'm using ash_authentication_phoenix. i want to redirect user after sign-in to "/dashboard" and prevent unsigned user from the route. ...

How to do the LiveComponent preload example in Ash.Query?

In the docs for the Phoenix.LiveComponent (https://hexdocs.pm/phoenix_live_view/Phoenix.LiveComponent.html#module-preloading-and-update) there is a section there that shows how to use preload/1 to solve the N+1 problem: ```elixir def preload(list_of_assigns) do list_of_ids = Enum.map(list_of_assigns, & &1.id)...

Ash Way of Doing Password Hashing and Storage for Phoenix.

So mix phx.gen.auth will give you the some of the following in your_app/lib/your_app/accounts/user.ex: ```elixir defp validate_email(changeset) do changeset...

Sorting on a field in a relation

I tried the solution from https://discordapp.com/channels/711271361523351632/1072944619169534063, but can't seem to get it to work. Am I missing something? tweet.ex ``` read :feed do...

How to Delete Resource?

I have a resource that has attributes and relationships to other resources. I want to delete it completely, how would I do that?

No actor, policy enforcement.

When creating the policy for read that "relates_to_actor_via" the policy only seems to come into play if there is an actor. If no actor is passed then that policy seems to be ignored. Eg. the images below. If you pass the incorrect actor, it does not pass data. As expected. If you pass no actor, it gives you everything. As per the second image. Is this an error in my own logic or is this a bug?...
No description

Updating array embeds

https://ash-hq.org/docs/guides/ash/latest/topics/embedded-resources says this for Array embeds
All values in the original array are destroyed, and all maps in the new array are used to create new records.
All values in the original array are destroyed, and all maps in the new array are used to create new records.
Ecto has an api to update array embeds while keeping existing ids. Is there a way to do the same using Ash?...

AshPhoenix.Form for an Ash.Flow module instead of Ash.Resource

I really like AshPhoenix and I just figured out how to use Ash.Flow. Is it possible to initialize an AshPhoenix.Form object for an Ash.Flow module instead of the usual Ash.Resource?