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

LiveView interface for {:array, :string} type

I'm making a LiveView interface to edit a resource with an {:array, :string} Ash type attribute and I'm looking for up-to-date, Ash-aware best practices. I've cobbled a few prototypes together but I feel like I'm missing something fundamental and getting hacky. Is there any documentation on the idiomatic way to accomplish this?

relates_to_actor_attribute_via

I have a resource called Actor that is not backed by the database, it looks something like this: ```elixir defmodule Ht.Actor do use Ash.Resource, data_layer: Ash.DataLayer.Ets...

Policy for explicitly setting relationship on create

I have a number of resources that are is_a other resources. That is: ```elixir defmacro is_a(attr, type, opts \ []) do quote do relationships do...

`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!): ``` warning: form_for/3 without an anonymous function is deprecated. If you are using Phoenix.LiveView, use the new Phoenix.Component.form/1 component (phoenix_html 3.3.1) lib/phoenix_html/form.ex:341: Phoenix.HTML.Form.form_for/3...

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: ```elixir filter_form = FilterForm.new(Property) {filter_form, group_id} = FilterForm.add_group(filter_form, operator: :or, return_id?: true)...

Override resource field before validation

I have a slug field that is based on a name. I want to be able to set it from title by something like slugify in Django. But I'm not able to override nil values of fields before they get validated in create action. I've used change but it is not called when slug is nil. I don't want to do it before calling create action because it just doesn't feel right and dry. If I enable this action through an API and web interface than it will be 2 places to convert title to slug. In case you don't know what slug is, here's wikipedia article. https://en.wikipedia.org/wiki/Slug_%28publishing%29 It is used in URL to uniquely identify a resource and this term comes from publishing. URL safe title is not fast to write is it? Django is my background where this term is frequently used....

pub_sub event not being broadcasted

I have this action in my resource: ```elixir update :update_images do accept [:status, :images]...

Are accept fields in an update action required by default?

I have the following update action: ```elixir update :update_images do accept [:id, :status, :images]...

Transaction between separated actions

I believe I already have the answer for that, but I just want to double check if that is the best/correct way to do it with Ash. If I have two actions, say, User.add!() and Marketing.add!() and want to run them inside the same transaction, should I just do this? ```elixir...

Help with manage_related

The AshAdmin Demo uses the "manage_related" option in form to allow the Admin UI to know details about displaying a related resource. When I use "manage_related" (just as shown in the video), I get the following compilation error: "(CompileError) undefined function manage_related/1 (there is no such import) Stacktrace:...

Returning success on failure as a security consideration

There are a few cases where I would like to pretend that an action was successful—sometimes regardless of the outcome, sometimes in specific cases. Is there a way to simulate a successful result currently without committing the changeset? Generally to control the response independent of the action result? Definitely related to https://discord.com/channels/711271361523351632/1089558275873325198...

Custom made AshAuthentication LiveViews

Hey guys, I wanted to have more customization than what AshAuthentication allows in its LiveViews for sign-in/up, reset, etc. Maybe someone else also needs the same thing, so I will show here all the steps I did to make that happen so others can use as reference. Also, any suggestion on improvements are welcome....

Errors with OpenAPI (not already existing atom)

Installed the new OpenAPI stuff earlier. Getting: ```sh Request: GET /api/json/openapi (exit) an exception was raised: (ArgumentError) errors were found at the given arguments:...

Raw actions

CFE: ```elixir defmodule App.Echo do use Ash.Resource, extensions: [AshJsonApi.Resource, AshGraphql.Resource]...

Can't test authentication after configuring Ash AuthenticationPhoenix Tutorial

After following steps on the tutorial for configuring authentication with phoenix, im getting errors on the routes as if the AuthController was not working. When Accessing the main route http://localhost:4000 i get this error: ``` [info] GET / [debug] Processing with CaseHolderWeb.PageController.home/2...
No description

passing actor when using AshPhoenix.Form.submit

I've been reading the policy guide and docs and I've got them up and running for all my read actions, but when submitting a create or update using AshPhoenix.Form I'm not sure where exactly to provide the actor. Is there a different way this is meant to be done?

Improve compile times

I have noticed that my compile times are growing. For example, if I change one resource file and compile, it takes about 8 seconds for the compilation to complete. I started out with a single Ash API, and I have now split this into two. However, compiling with the --verbose flag shows that all files in the the api of the modified resource are compiled (expected) however a number of resources from the other API are also recompiled. 23 files are recompiled in total. So, is 8 seconds to recompile 23 files on an M1 Macbook pro normal? Could the fact that I have cross-api relationships be contributing to this? 8 seconds doesn't sound bad, however as the application grows it could become a barrier to doing test driven development....

ashauthentication: possible bugs?

I have a couple errors coming up with AshAuthentication, not sure if they're bugs or me doing something wrong. 1) If I disable registration: ```elixir strategies do...

Incrementing an attribute

What I have been doing is this: ```elixir change fn changeset, opts -> attempts = Ash.Changeset.get_attribute(changeset, :attempts) Ash.Changeset.change_attribute(changeset, :attempts, attempts + 1)...

Does order matter in filtering resources?

This seems to be returning all buys and not filtering by user_id == user.id. ``` Resource |> Ash.Query.for_read(:buys)...